Skip to main content

pito_header/
styles.rs

1use ratatui::style::{Modifier, Style};
2
3#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
4pub struct Styles {
5    pub accent: Style,
6    pub muted: Style,
7    pub rule: Style,
8}
9
10impl Styles {
11    pub const fn new() -> Self {
12        Styles {
13            accent: Style::new(),
14            muted: Style::new(),
15            rule: Style::new(),
16        }
17    }
18
19    pub const fn accent(mut self, style: Style) -> Self {
20        self.accent = style;
21        self
22    }
23
24    pub const fn muted(mut self, style: Style) -> Self {
25        self.muted = style;
26        self
27    }
28
29    pub const fn rule(mut self, style: Style) -> Self {
30        self.rule = style;
31        self
32    }
33
34    pub(crate) fn lit(&self) -> Style {
35        self.accent.add_modifier(Modifier::BOLD)
36    }
37}