From d7f17eb321170da0e4c85248d7e5cefde3dbe9e5 Mon Sep 17 00:00:00 2001 From: Twan Stok Date: Fri, 31 Mar 2023 03:59:30 +0200 Subject: [PATCH] implemented missing canvas styling logic --- src/canvas/canvas_styling.rs | 12 ++++++++++++ src/constants.rs | 10 ++++++++++ src/options.rs | 2 ++ 3 files changed, 24 insertions(+) diff --git a/src/canvas/canvas_styling.rs b/src/canvas/canvas_styling.rs index b1c1d43b..b06729b9 100644 --- a/src/canvas/canvas_styling.rs +++ b/src/canvas/canvas_styling.rs @@ -166,6 +166,12 @@ impl CanvasColours { .context("Update 'ram_color' in your config file..")?; } + #[cfg(not(target_os = "windows"))] + if let Some(cache_color) = &colours.cache_color { + self.set_cache_colour(cache_color) + .context("Update 'cache_color' in your config file..")?; + } + if let Some(swap_color) = &colours.swap_color { self.set_swap_colour(swap_color) .context("Update 'swap_color' in your config file..")?; @@ -279,6 +285,12 @@ impl CanvasColours { Ok(()) } + #[cfg(not(target_os = "windows"))] + pub fn set_cache_colour(&mut self, colour: &str) -> error::Result<()> { + self.cache_style = str_to_fg(colour)?; + Ok(()) + } + pub fn set_swap_colour(&mut self, colour: &str) -> error::Result<()> { self.swap_style = str_to_fg(colour)?; Ok(()) diff --git a/src/constants.rs b/src/constants.rs index bc472fd0..0d9cd1d5 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -37,6 +37,8 @@ pub static DEFAULT_LIGHT_MODE_COLOUR_PALETTE: Lazy = Lazy::new(|| graph_color: Some("black".into()), disabled_text_color: Some("gray".into()), ram_color: Some("blue".into()), + #[cfg(not(target_os = "windows"))] + cache_color: Some("LightRed".into()), swap_color: Some("red".into()), arc_color: Some("LightBlue".into()), gpu_core_colors: Some(vec![ @@ -91,6 +93,8 @@ pub static GRUVBOX_COLOUR_PALETTE: Lazy = Lazy::new(|| ConfigColo "#af3a03".into(), ]), ram_color: Some("#8ec07c".into()), + #[cfg(not(target_os = "windows"))] + cache_color: Some("#d79921".into()), swap_color: Some("#fabd2f".into()), arc_color: Some("#689d6a".into()), gpu_core_colors: Some(vec![ @@ -146,6 +150,8 @@ pub static GRUVBOX_LIGHT_COLOUR_PALETTE: Lazy = Lazy::new(|| Conf "#af3a03".into(), ]), ram_color: Some("#427b58".into()), + #[cfg(not(target_os = "windows"))] + cache_color: Some("9d0006".into()), swap_color: Some("#cc241d".into()), arc_color: Some("#689d6a".into()), gpu_core_colors: Some(vec![ @@ -189,6 +195,8 @@ pub static NORD_COLOUR_PALETTE: Lazy = Lazy::new(|| ConfigColours "#bf616a".into(), ]), ram_color: Some("#88c0d0".into()), + #[cfg(not(target_os = "windows"))] + cache_color: Some("#8fbcbb".into()), swap_color: Some("#d08770".into()), arc_color: Some("#5e81ac".into()), gpu_core_colors: Some(vec![ @@ -232,6 +240,8 @@ pub static NORD_LIGHT_COLOUR_PALETTE: Lazy = Lazy::new(|| ConfigC "#bf616a".into(), ]), ram_color: Some("#81a1c1".into()), + #[cfg(not(target_os = "windows"))] + cache_color: Some("#8fbcbb".into()), swap_color: Some("#d08770".into()), arc_color: Some("#5e81ac".into()), gpu_core_colors: Some(vec![ diff --git a/src/options.rs b/src/options.rs index 2931f4aa..72cfa616 100644 --- a/src/options.rs +++ b/src/options.rs @@ -92,7 +92,9 @@ pub struct ConfigColours { pub all_cpu_color: Option>, pub avg_cpu_color: Option>, pub cpu_core_colors: Option>>, + #[cfg(not(target_os = "windows"))] pub ram_color: Option>, + pub cache_color: Option>, pub swap_color: Option>, pub arc_color: Option>, pub gpu_core_colors: Option>>,