diff options
Diffstat (limited to 'util/flashrom_tester/src/types.rs')
-rw-r--r-- | util/flashrom_tester/src/types.rs | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/util/flashrom_tester/src/types.rs b/util/flashrom_tester/src/types.rs index b22ded2b4..9cefb27e9 100644 --- a/util/flashrom_tester/src/types.rs +++ b/util/flashrom_tester/src/types.rs @@ -33,21 +33,40 @@ // Software Foundation. // -pub const BOLD: &str = "\x1b[1m"; +pub struct Color { + pub bold: &'static str, + pub reset: &'static str, + pub magenta: &'static str, + pub yellow: &'static str, + pub green: &'static str, + pub red: &'static str, +} + +pub const COLOR: Color = Color { + bold: "\x1b[1m", + reset: "\x1b[0m", + magenta: "\x1b[35m", + yellow: "\x1b[33m", + green: "\x1b[92m", + red: "\x1b[31m", +}; -pub const RESET: &str = "\x1b[0m"; -pub const MAGENTA: &str = "\x1b[35m"; -pub const YELLOW: &str = "\x1b[33m"; -pub const GREEN: &str = "\x1b[92m"; -pub const RED: &str = "\x1b[31m"; +pub const NOCOLOR: Color = Color { + bold: "", + reset: "", + magenta: "", + yellow: "", + green: "", + red: "", +}; macro_rules! style_dbg { - ($s: expr, $c: expr) => { - format!("{}{:?}{}", $c, $s, types::RESET) + ($s: expr, $c: expr, $col: expr) => { + format!("{}{:?}{}", $c, $s, $col.reset) }; } macro_rules! style { - ($s: expr, $c: expr) => { - format!("{}{}{}", $c, $s, types::RESET) + ($s: expr, $c: expr, $col: expr) => { + format!("{}{}{}", $c, $s, $col.reset) }; } |