ui/themes: make theme_default the default for other keys

memfd
Manos Pitsidianakis 2020-02-08 23:53:20 +02:00
parent eef007600b
commit 42747ef590
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 12 additions and 2 deletions

View File

@ -205,7 +205,7 @@ pub struct ThemeAttribute {
}
/// Holds {fore,back}ground color and terminal attribute values.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ThemeAttributeInner {
#[serde(default)]
fg: ThemeValue<Color>,
@ -215,6 +215,16 @@ pub struct ThemeAttributeInner {
attrs: ThemeValue<Attr>,
}
impl Default for ThemeAttributeInner {
fn default() -> Self {
Self {
fg: "theme_default".into(),
bg: "theme_default".into(),
attrs: "theme_default".into(),
}
}
}
#[derive(Debug, Clone)]
/// Holds either an actual value or refers to the key name of the attribute that holds the value.
pub enum ThemeValue<T> {
@ -459,7 +469,7 @@ impl Default for Theme {
dark.insert($key.into(), ThemeAttributeInner::default());
};
}
add!("theme_default");
add!("theme_default", dark = { fg: Color::Default, bg: Color::Default, attrs: Attr::Default }, light = { fg: Color::Default, bg: Color::Default, attrs: Attr::Default });
add!("status.bar", dark = { fg: Color::Byte(123), bg: Color::Byte(26) }, light = { fg: Color::Byte(123), bg: Color::Byte(26) });
add!("status.notification", dark = { fg: Color::Byte(219), bg: Color::Byte(88) }, light = { fg: Color::Byte(219), bg: Color::Byte(88) });