From d25134bc6b8b13d5ff550c950c65b6e9c4a7a267 Mon Sep 17 00:00:00 2001 From: Rémi Garde Date: Mon, 23 Jul 2018 18:48:27 +0200 Subject: Add optional dim foreground color Add optional color for the dim foreground (`\e[2m;`) Defaults to 2/3 of the foreground color. (same as other colors). If a bright color is dimmed, it's displayed as the normal color. The exception for this is when the bright foreground is dimmed when no bright foreground color is set. In that case it's treated as a normal foreground color and dimmed to DimForeground. To minimize the surprise for the user, the bright and dim colors have been completely removed from the default configuration file. Some documentation has also been added to make it clear to users what these options can be used for. This fixes #1448. --- src/config.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 76daee05..b50e3243 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1023,11 +1023,13 @@ pub struct PrimaryColors { pub background: Rgb, #[serde(deserialize_with = "rgb_from_hex")] pub foreground: Rgb, - #[serde(default, deserialize_with = "deserialize_bright_foreground")] + #[serde(default, deserialize_with = "deserialize_optional_color")] pub bright_foreground: Option, + #[serde(default, deserialize_with = "deserialize_optional_color")] + pub dim_foreground: Option, } -fn deserialize_bright_foreground<'a, D>(deserializer: D) -> ::std::result::Result, D::Error> +fn deserialize_optional_color<'a, D>(deserializer: D) -> ::std::result::Result, D::Error> where D: de::Deserializer<'a> { match Option::deserialize(deserializer) { @@ -1049,6 +1051,7 @@ impl Default for PrimaryColors { background: Rgb { r: 0, g: 0, b: 0 }, foreground: Rgb { r: 0xea, g: 0xea, b: 0xea }, bright_foreground: None, + dim_foreground: None, } } } -- cgit