theme: add ThemeColor enum
This commit is contained in:
parent
c75b6ef66e
commit
cf8b696f03
4 changed files with 82 additions and 41 deletions
19
src/theme.rs
19
src/theme.rs
|
|
@ -392,6 +392,25 @@ macro_rules! colors {
|
|||
)*
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Linearize)]
|
||||
#[expect(non_camel_case_types)]
|
||||
pub enum ThemeColor {
|
||||
$(
|
||||
$name,
|
||||
)*
|
||||
}
|
||||
|
||||
impl ThemeColor {
|
||||
pub fn field(self, theme: &Theme) -> &Cell<Color> {
|
||||
let colors = &theme.colors;
|
||||
match self {
|
||||
$(
|
||||
Self::$name => &colors.$name,
|
||||
)*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ThemeColors {
|
||||
pub fn reset(&self) {
|
||||
let default = Self::default();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue