aboutsummaryrefslogtreecommitdiff
path: root/src/ansi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ansi.rs')
-rw-r--r--src/ansi.rs46
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
}
}