use crate::{font::FontWeight, graphics::colours::RGBA, Align, FontFamily, TextAlign};
#[derive(Debug, Clone, PartialEq)]
pub struct TextTheme {
pub font_size: u32,
pub font_weight: FontWeight,
pub colour: RGBA,
pub align: TextAlign,
}
impl Default for TextTheme {
fn default() -> Self {
Self {
font_size: 16,
font_weight: FontWeight::default(),
colour: RGBA::default(),
align: Align::Left,
}
}
}
#[derive(Debug, Clone)]
pub struct Theme {
pub primary_colour: RGBA,
pub secondary_colour: RGBA,
pub highlight_colour: RGBA,
pub focus_colour: RGBA,
pub font: Option<FontFamily>,
pub title: TextTheme,
pub subtitle: TextTheme,
pub text1: TextTheme,
pub text2: TextTheme,
}
impl Default for Theme {
fn default() -> Self {
Self {
primary_colour: RGBA::new(255, 255, 255, 255),
secondary_colour: RGBA::new(0, 0, 0, 255),
highlight_colour: RGBA::new(255, 0, 0, 255),
focus_colour: RGBA::new(0, 0, 0, 100),
font: None,
title: TextTheme {
font_size: 24,
font_weight: FontWeight::Bold,
colour: RGBA::new(0, 0, 0, 255),
align: TextAlign::Center,
},
subtitle: TextTheme {
font_size: 18,
font_weight: FontWeight::SemiBold,
colour: RGBA::new(0, 0, 0, 255),
align: TextAlign::Center,
},
text1: TextTheme {
font_size: 12,
font_weight: FontWeight::Medium,
colour: RGBA::new(0, 0, 0, 255),
align: TextAlign::Left,
},
text2: TextTheme {
font_size: 12,
font_weight: FontWeight::Medium,
colour: RGBA::new(0, 0, 0, 255),
align: TextAlign::Left,
},
}
}
}
impl Theme {
pub fn ayu() -> Self {
let font_colour = RGBA::from_hex(0xBFBDB6);
Self {
primary_colour: RGBA::from_hex(0x0D101700),
secondary_colour: RGBA::from_hex(0x131721),
highlight_colour: RGBA::from_hex(0xE6B450),
focus_colour: RGBA::from_hex(0x47526640),
font: None,
title: TextTheme {
font_size: 24,
font_weight: FontWeight::Bold,
colour: font_colour,
align: TextAlign::Center,
},
subtitle: TextTheme {
font_size: 18,
font_weight: FontWeight::SemiBold,
colour: font_colour,
align: TextAlign::Center,
},
text1: TextTheme {
font_size: 12,
font_weight: FontWeight::Medium,
colour: font_colour,
align: TextAlign::Left,
},
text2: TextTheme {
font_size: 12,
font_weight: FontWeight::Medium,
colour: RGBA::from_hex(0x39BAE6),
align: TextAlign::Left,
},
}
}
}