refactor: introduce thread local THEME variable and distinguish between custom and system theme settings

This commit is contained in:
Ashley Wulber 2023-08-04 15:48:34 -04:00 committed by Ashley Wulber
parent 40efcbbe31
commit 6c57e04e36
8 changed files with 80 additions and 36 deletions

View file

@ -27,6 +27,7 @@ pub enum ThemeVariant {
HighContrastDark,
HighContrastLight,
Custom,
System,
}
impl From<&ThemeType> for ThemeVariant {
@ -37,6 +38,7 @@ impl From<&ThemeType> for ThemeVariant {
ThemeType::HighContrastDark => ThemeVariant::HighContrastDark,
ThemeType::HighContrastLight => ThemeVariant::HighContrastLight,
ThemeType::Custom(_) => ThemeVariant::Custom,
ThemeType::System(_) => ThemeVariant::System,
}
}
}
@ -210,8 +212,9 @@ impl State {
ThemeVariant::Light,
ThemeVariant::Dark,
ThemeVariant::HighContrastLight,
ThemeVariant::HighContrastLight,
ThemeVariant::HighContrastDark,
ThemeVariant::Custom,
ThemeVariant::System,
]
.into_iter()
.fold(