use egui::{CornerRadius, FontFamily, FontId, Vec2};
pub mod theme_ext;
pub mod web_palette;
#[derive(Clone, Debug)]
pub struct StyledTheme {
pub rounding_sm: CornerRadius,
pub rounding_md: CornerRadius,
pub rounding_lg: CornerRadius,
pub rounding_full: CornerRadius,
pub spacing_xs: f32,
pub spacing_sm: f32,
pub spacing_md: f32,
pub spacing_lg: f32,
pub spacing_xl: f32,
pub font_size_sm: f32,
pub font_size_md: f32,
pub font_size_lg: f32,
pub font_size_xl: f32,
pub font_family_display: FontFamily,
pub font_family_body: FontFamily,
pub font_family_mono: FontFamily,
pub shadow_sm: Vec2,
pub shadow_md: Vec2,
pub shadow_lg: Vec2,
pub glow_sm: f32,
pub glow_md: f32,
pub glow_lg: f32,
}
impl StyledTheme {
pub fn font_display(&self, size: f32) -> FontId {
FontId::new(size, self.font_family_display.clone())
}
pub fn font_body(&self, size: f32) -> FontId {
FontId::new(size, self.font_family_body.clone())
}
pub fn font_mono(&self, size: f32) -> FontId {
FontId::new(size, self.font_family_mono.clone())
}
}
impl Default for StyledTheme {
fn default() -> Self {
Self {
rounding_sm: CornerRadius::same(2),
rounding_md: CornerRadius::same(4),
rounding_lg: CornerRadius::same(8),
rounding_full: CornerRadius::same(u8::MAX),
spacing_xs: 2.0,
spacing_sm: 4.0,
spacing_md: 8.0,
spacing_lg: 16.0,
spacing_xl: 32.0,
font_size_sm: 12.0,
font_size_md: 14.0,
font_size_lg: 18.0,
font_size_xl: 24.0,
font_family_display: FontFamily::Proportional,
font_family_body: FontFamily::Proportional,
font_family_mono: FontFamily::Monospace,
shadow_sm: Vec2::new(0.0, 1.0),
shadow_md: Vec2::new(0.0, 2.0),
shadow_lg: Vec2::new(0.0, 4.0),
glow_sm: 4.0,
glow_md: 8.0,
glow_lg: 16.0,
}
}
}