diff options
Diffstat (limited to 'cli/colors.rs')
-rw-r--r-- | cli/colors.rs | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/cli/colors.rs b/cli/colors.rs index 3a1616d97..93f252716 100644 --- a/cli/colors.rs +++ b/cli/colors.rs @@ -4,9 +4,7 @@ use regex::Regex; use std::env; use std::fmt; use std::io::Write; -use termcolor::Color::{ - Ansi256, Black, Blue, Cyan, Green, Magenta, Red, White, Yellow, -}; +use termcolor::Color::{Ansi256, Black, Blue, Cyan, Green, Red, White, Yellow}; use termcolor::{Ansi, ColorSpec, WriteColor}; #[cfg(windows)] @@ -24,6 +22,7 @@ lazy_static! { } /// Helper function to strip ansi codes. +#[cfg(test)] pub fn strip_ansi_codes(s: &str) -> std::borrow::Cow<str> { STRIP_ANSI_RE.replace_all(s, "") } @@ -67,24 +66,12 @@ pub fn italic_bold(s: &str) -> impl fmt::Display { style(&s, style_spec) } -pub fn black_on_white(s: &str) -> impl fmt::Display { - let mut style_spec = ColorSpec::new(); - style_spec.set_bg(Some(White)).set_fg(Some(Black)); - style(&s, style_spec) -} - pub fn white_on_red(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_bg(Some(Red)).set_fg(Some(White)); style(&s, style_spec) } -pub fn white_on_green(s: &str) -> impl fmt::Display { - let mut style_spec = ColorSpec::new(); - style_spec.set_bg(Some(Green)).set_fg(Some(White)); - style(&s, style_spec) -} - pub fn black_on_green(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_bg(Some(Green)).set_fg(Some(Black)); @@ -115,12 +102,6 @@ pub fn green(s: &str) -> impl fmt::Display { style(&s, style_spec) } -pub fn magenta(s: &str) -> impl fmt::Display { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Magenta)); - style(&s, style_spec) -} - pub fn bold(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_bold(true); @@ -133,12 +114,6 @@ pub fn gray(s: &str) -> impl fmt::Display { style(&s, style_spec) } -pub fn italic_gray(s: &str) -> impl fmt::Display { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Ansi256(8))).set_italic(true); - style(&s, style_spec) -} - pub fn italic_bold_gray(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec |