use esoc_gfx::color::Color;
use esoc_gfx::palette::Palette;
#[derive(Clone, Debug)]
pub struct Theme {
pub background: Color,
pub foreground: Color,
pub palette: Palette,
pub grid_color: Color,
pub grid_width: f64,
pub show_grid: bool,
pub title_font_size: f64,
pub label_font_size: f64,
pub tick_font_size: f64,
pub legend_font_size: f64,
pub font_family: String,
pub axis_width: f64,
pub line_width: f64,
pub point_radius: f64,
}
impl Theme {
pub fn light() -> Self {
Self {
background: Color::WHITE,
foreground: Color::BLACK,
palette: Palette::tab10(),
grid_color: Color::new(0.9, 0.9, 0.9, 1.0),
grid_width: 0.5,
show_grid: true,
title_font_size: 16.0,
label_font_size: 13.0,
tick_font_size: 11.0,
legend_font_size: 11.0,
font_family: "sans-serif".to_string(),
axis_width: 1.0,
line_width: 2.0,
point_radius: 4.0,
}
}
pub fn dark() -> Self {
Self {
background: Color::from_rgb8(0x1e, 0x1e, 0x2e),
foreground: Color::from_rgb8(0xcd, 0xd6, 0xf4),
palette: Palette::tab10(),
grid_color: Color::new(0.3, 0.3, 0.35, 1.0),
grid_width: 0.5,
show_grid: true,
title_font_size: 16.0,
label_font_size: 13.0,
tick_font_size: 11.0,
legend_font_size: 11.0,
font_family: "sans-serif".to_string(),
axis_width: 1.0,
line_width: 2.0,
point_radius: 4.0,
}
}
pub fn minimal() -> Self {
Self {
background: Color::WHITE,
foreground: Color::from_rgb8(0x33, 0x33, 0x33),
palette: Palette::tab10(),
grid_color: Color::TRANSPARENT,
grid_width: 0.0,
show_grid: false,
title_font_size: 14.0,
label_font_size: 12.0,
tick_font_size: 10.0,
legend_font_size: 10.0,
font_family: "sans-serif".to_string(),
axis_width: 0.5,
line_width: 1.5,
point_radius: 3.0,
}
}
}
impl Default for Theme {
fn default() -> Self {
Self::light()
}
}