use crate::{common::*, util::Color};
#[derive(Clone)]
pub struct StyleSheetContainer {
pub host: StyleSheet,
pub anchor: StyleSheet,
pub anchor_hover: StyleSheet,
pub selection: StyleSheet,
pub heading_title: HashMap<usize, StyleSheet>,
}
impl Default for StyleSheetContainer {
fn default() -> Self {
Self {
host: default(),
anchor: default(),
anchor_hover: with! {
text_decoration: Some(TextDecoration::Underline),
..
},
selection: with! {
background_color: Some(Color::new(0.0, 0.0, 0.0, 1.0)),
color: Some(Color::new(1.0, 1.0, 1.0, 1.0)),
..
},
heading_title: hashmap! {},
}
}
}
#[derive(Clone)]
pub struct StyleSheet {
pub font_size: Option<f64>,
pub font_family: Option<String>,
pub font_weight: Option<u32>,
pub lighter: Option<bool>,
pub bold: Option<bool>,
pub italic: Option<bool>,
pub color: Option<Color>,
pub background_color: Option<Color>,
pub text_decoration: Option<TextDecoration>,
pub text_transform: Option<TextTransform>,
}
impl Default for StyleSheet {
fn default() -> Self {
Self {
font_size: None,
font_family: None,
font_weight: None,
lighter: None,
bold: None,
italic: None,
color: None,
background_color: None,
text_decoration: None,
text_transform: None,
}
}
}
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum TextDecoration {
None,
Underline,
}
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum TextTransform {
None,
Capitalize,
Lowercase,
Uppercase,
}