From 2fc5120327c6eb096154214faec5dc4e1dee2253 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Thu, 9 Apr 2020 04:02:10 +0300 Subject: Use config colors to theme Wayland decorations Fixes #2092. --- alacritty_terminal/src/term/color.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'alacritty_terminal') diff --git a/alacritty_terminal/src/term/color.rs b/alacritty_terminal/src/term/color.rs index b452245e..f9d7cf3a 100644 --- a/alacritty_terminal/src/term/color.rs +++ b/alacritty_terminal/src/term/color.rs @@ -11,6 +11,9 @@ use crate::config::{Colors, LOG_TARGET_CONFIG}; pub const COUNT: usize = 269; +/// Factor for automatic computation of dim colors used by terminal. +pub const DIM_FACTOR: f32 = 0.66; + pub const RED: Rgb = Rgb { r: 0xff, g: 0x0, b: 0x0 }; pub const YELLOW: Rgb = Rgb { r: 0xff, g: 0xff, b: 0x0 }; @@ -181,7 +184,7 @@ impl List { // Dims self[ansi::NamedColor::DimForeground] = - colors.primary.dim_foreground.unwrap_or(colors.primary.foreground * 0.66); + colors.primary.dim_foreground.unwrap_or(colors.primary.foreground * DIM_FACTOR); match colors.dim { Some(ref dim) => { trace!("Using config-provided dim colors"); @@ -196,14 +199,14 @@ impl List { }, None => { trace!("Deriving dim colors from normal colors"); - self[ansi::NamedColor::DimBlack] = colors.normal().black * 0.66; - self[ansi::NamedColor::DimRed] = colors.normal().red * 0.66; - self[ansi::NamedColor::DimGreen] = colors.normal().green * 0.66; - self[ansi::NamedColor::DimYellow] = colors.normal().yellow * 0.66; - self[ansi::NamedColor::DimBlue] = colors.normal().blue * 0.66; - self[ansi::NamedColor::DimMagenta] = colors.normal().magenta * 0.66; - self[ansi::NamedColor::DimCyan] = colors.normal().cyan * 0.66; - self[ansi::NamedColor::DimWhite] = colors.normal().white * 0.66; + self[ansi::NamedColor::DimBlack] = colors.normal().black * DIM_FACTOR; + self[ansi::NamedColor::DimRed] = colors.normal().red * DIM_FACTOR; + self[ansi::NamedColor::DimGreen] = colors.normal().green * DIM_FACTOR; + self[ansi::NamedColor::DimYellow] = colors.normal().yellow * DIM_FACTOR; + self[ansi::NamedColor::DimBlue] = colors.normal().blue * DIM_FACTOR; + self[ansi::NamedColor::DimMagenta] = colors.normal().magenta * DIM_FACTOR; + self[ansi::NamedColor::DimCyan] = colors.normal().cyan * DIM_FACTOR; + self[ansi::NamedColor::DimWhite] = colors.normal().white * DIM_FACTOR; }, } } -- cgit v1.2.3-54-g00ecf