From 6c75ff414660f2e85a652ccf1004cd163860ebc1 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Fri, 9 Feb 2018 20:54:17 -0800 Subject: [PATCH] Use brighter version of ANSI color when bold enabled This is one of the main reasons that I started to build my own terminal emulator :-p --- src/xwin.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/xwin.rs b/src/xwin.rs index b6ff4c558..5bf6a7650 100644 --- a/src/xwin.rs +++ b/src/xwin.rs @@ -628,7 +628,22 @@ impl<'a> TerminalWindow<'a> { } else { fg_color }; - let glyph_color = self.palette.resolve(glyph_color); + let glyph_color = match glyph_color { + &term::color::ColorAttribute::PaletteIndex(idx) if idx < 8 => { + // For compatibility purposes, switch to a brighter version + // of one of the standard ANSI colors when Bold is enabled. + // This lifts black to dark grey. + let idx = if attrs.intensity() == term::Intensity::Bold { + idx + 8 + } else { + idx + }; + self.palette.resolve( + &term::color::ColorAttribute::PaletteIndex(idx), + ) + } + _ => self.palette.resolve(glyph_color), + }; let operator = if glyph.has_color { xgfx::Operator::Over } else {