diff options
author | Jake Merdich <jake@merdich.com> | 2017-06-23 10:01:53 -0700 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-06-23 11:27:15 -0700 |
commit | b4a839aee9784a2d281be1bec87ac6f2ae4a79f0 (patch) | |
tree | 19a72d9a8a80c472a5cc4bf431e769695b01a02c /src/ansi.rs | |
parent | 0091d3cb99e69ffc946ab6bbf40530ff8694b246 (diff) | |
download | alacritty-b4a839aee9784a2d281be1bec87ac6f2ae4a79f0.tar.gz alacritty-b4a839aee9784a2d281be1bec87ac6f2ae4a79f0.zip |
Add dim color support
Add support for the VTE 'dim' flag, with additional support for
custom-themed dim colors. If no color is specified in the config, it
will default to 2/3 the previous (not a spec, but the value other
terminals seem to use).
The actual dimming behavior brings bright colors to normal and regular
colors to the new dim ones. Custom RGB values are not changed, nor are
non-named indexed colors.
Diffstat (limited to 'src/ansi.rs')
-rw-r--r-- | src/ansi.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ansi.rs b/src/ansi.rs index 5114f7df..2eccf335 100644 --- a/src/ansi.rs +++ b/src/ansi.rs @@ -442,6 +442,22 @@ pub enum NamedColor { CursorText, /// Color for the cursor itself Cursor, + /// Dim black + DimBlack, + /// Dim red + DimRed, + /// Dim green + DimGreen, + /// Dim yellow + DimYellow, + /// Dim blue + DimBlue, + /// Dim magenta + DimMagenta, + /// Dim cyan + DimCyan, + /// Dim white + DimWhite, } impl NamedColor { @@ -455,6 +471,36 @@ impl NamedColor { NamedColor::Magenta => NamedColor::BrightMagenta, NamedColor::Cyan => NamedColor::BrightCyan, NamedColor::White => NamedColor::BrightWhite, + NamedColor::DimBlack => NamedColor::Black, + NamedColor::DimRed => NamedColor::Red, + NamedColor::DimGreen => NamedColor::Green, + NamedColor::DimYellow => NamedColor::Yellow, + NamedColor::DimBlue => NamedColor::Blue, + NamedColor::DimMagenta => NamedColor::Magenta, + NamedColor::DimCyan => NamedColor::Cyan, + NamedColor::DimWhite => NamedColor::White, + val => val + } + } + + pub fn to_dim(&self) -> Self { + match *self { + NamedColor::Black => NamedColor::DimBlack, + NamedColor::Red => NamedColor::DimRed, + NamedColor::Green => NamedColor::DimGreen, + NamedColor::Yellow => NamedColor::DimYellow, + NamedColor::Blue => NamedColor::DimBlue, + NamedColor::Magenta => NamedColor::DimMagenta, + NamedColor::Cyan => NamedColor::DimCyan, + NamedColor::White => NamedColor::DimWhite, + NamedColor::BrightBlack => NamedColor::Black, + NamedColor::BrightRed => NamedColor::Red, + NamedColor::BrightGreen => NamedColor::Green, + NamedColor::BrightYellow => NamedColor::Yellow, + NamedColor::BrightBlue => NamedColor::Blue, + NamedColor::BrightMagenta => NamedColor::Magenta, + NamedColor::BrightCyan => NamedColor::Cyan, + NamedColor::BrightWhite => NamedColor::White, val => val } } |