diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2020-12-06 16:52:29 -0500 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2020-12-06 16:52:29 -0500 |
commit | bf9c102a4cfb85a9fd910195e6372dcd1d062c16 (patch) | |
tree | e5e2e15234134b303e90ac52c2bf6f060ec10427 /src/config | |
parent | f18776324dbd78ebc83b748148e63827a8eddb37 (diff) |
version bump and code cleanup0.8.5
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/theme.rs | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/config/theme.rs b/src/config/theme.rs index fe88a5d..0ee57af 100644 --- a/src/config/theme.rs +++ b/src/config/theme.rs @@ -104,6 +104,45 @@ impl std::default::Default for JoshutoStyleThemeRaw { } } +#[derive(Clone, Debug)] +pub struct JoshutoStyleTheme { + pub fg: Color, + pub bg: Color, + pub modifier: Modifier, + pub prefix: Option<JoshutoPrefix>, +} + +impl JoshutoStyleTheme { + pub fn set_bg(mut self, bg: Color) -> Self { + self.bg = bg; + self + } + pub fn set_fg(mut self, fg: Color) -> Self { + self.fg = fg; + self + } + pub fn set_prefix(mut self, prefix: JoshutoPrefix) -> Self { + self.prefix = Some(prefix); + self + } + + pub fn insert(mut self, modifier: Modifier) -> Self { + self.modifier.insert(modifier); + self + } +} + +impl std::default::Default for JoshutoStyleTheme { + fn default() -> Self { + Self { + fg: default_color(), + bg: default_color(), + modifier: Modifier::empty(), + prefix: None, + } + } +} + #[derive(Clone, Debug, Deserialize)] pub struct JoshutoRawTheme { #[serde(default)] @@ -166,45 +205,6 @@ impl Flattenable<JoshutoTheme> for JoshutoRawTheme { } #[derive(Clone, Debug)] -pub struct JoshutoStyleTheme { - pub fg: Color, - pub bg: Color, - pub modifier: Modifier, - pub prefix: Option<JoshutoPrefix>, -} - -impl JoshutoStyleTheme { - pub fn set_bg(mut self, bg: Color) -> Self { - self.bg = bg; - self - } - pub fn set_fg(mut self, fg: Color) -> Self { - self.fg = fg; - self - } - pub fn set_prefix(mut self, prefix: JoshutoPrefix) -> Self { - self.prefix = Some(prefix); - self - } - - pub fn insert(mut self, modifier: Modifier) -> Self { - self.modifier.insert(modifier); - self - } -} - -impl std::default::Default for JoshutoStyleTheme { - fn default() -> Self { - Self { - fg: default_color(), - bg: default_color(), - modifier: Modifier::empty(), - prefix: None, - } - } -} - -#[derive(Clone, Debug)] pub struct JoshutoTheme { pub regular: JoshutoStyleTheme, pub selection: JoshutoStyleTheme, |