aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2018-07-15 19:47:07 +0000
committerGitHub <noreply@github.com>2018-07-15 19:47:07 +0000
commit96b3d737a8ee1805ec548671a6ba8f219b2c2934 (patch)
treef9f0b2ac5ea3aef5698dc525b04d3c5823f0cd09 /src/config.rs
parent4ae2bc66f2bd213511997addfed8b589fdc97406 (diff)
downloadalacritty-96b3d737a8ee1805ec548671a6ba8f219b2c2934.tar.gz
alacritty-96b3d737a8ee1805ec548671a6ba8f219b2c2934.zip
Add bright foreground color option
It was requested in jwilm/alacritty#825 that it should be possible to add an optional bright foreground color. This is now added to the primary colors structure and allows the user to set a foreground color for bold normal text. This has no effect unless the draw_bold_text_with_bright_colors option is also enabled. If the color is not specified, the bright foreground color will fall back to the normal foreground color. This fixes #825.
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index 95058d38..8d63a9c0 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1022,6 +1022,24 @@ pub struct PrimaryColors {
pub background: Rgb,
#[serde(deserialize_with = "rgb_from_hex")]
pub foreground: Rgb,
+ #[serde(default, deserialize_with = "deserialize_bright_foreground")]
+ pub bright_foreground: Option<Rgb>,
+}
+
+fn deserialize_bright_foreground<'a, D>(deserializer: D) -> ::std::result::Result<Option<Rgb>, D::Error>
+ where D: de::Deserializer<'a>
+{
+ match Option::deserialize(deserializer) {
+ Ok(Some(color)) => {
+ let color: serde_yaml::Value = color;
+ Ok(Some(rgb_from_hex(color).unwrap()))
+ },
+ Ok(None) => Ok(None),
+ Err(err) => {
+ eprintln!("problem with config: {}; Using standard foreground color", err);
+ Ok(None)
+ },
+ }
}
impl Default for PrimaryColors {
@@ -1029,6 +1047,7 @@ impl Default for PrimaryColors {
PrimaryColors {
background: Rgb { r: 0, g: 0, b: 0 },
foreground: Rgb { r: 0xea, g: 0xea, b: 0xea },
+ bright_foreground: None,
}
}
}