implemented missing canvas styling logic

This commit is contained in:
Twan Stok 2023-03-31 03:59:30 +02:00
parent e06b1b19ef
commit d7f17eb321
3 changed files with 24 additions and 0 deletions

View File

@ -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(())

View File

@ -37,6 +37,8 @@ pub static DEFAULT_LIGHT_MODE_COLOUR_PALETTE: Lazy<ConfigColours> = 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<ConfigColours> = 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<ConfigColours> = 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<ConfigColours> = 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<ConfigColours> = 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![

View File

@ -92,7 +92,9 @@ pub struct ConfigColours {
pub all_cpu_color: Option<Cow<'static, str>>,
pub avg_cpu_color: Option<Cow<'static, str>>,
pub cpu_core_colors: Option<Vec<Cow<'static, str>>>,
#[cfg(not(target_os = "windows"))]
pub ram_color: Option<Cow<'static, str>>,
pub cache_color: Option<Cow<'static, str>>,
pub swap_color: Option<Cow<'static, str>>,
pub arc_color: Option<Cow<'static, str>>,
pub gpu_core_colors: Option<Vec<Cow<'static, str>>>,