chroma_print/colors.rs
1/// Defines the `Color` enum and its associated ANSI escape codes for terminal coloring
2pub enum Color {
3 Green,
4 Yellow,
5 Red,
6 Cyan,
7 Reset,
8}
9
10impl Color {
11 /// Returns the ANSI escape code for the color
12 pub fn value(&self) -> &'static str {
13 return match self {
14 Color::Green => "\x1b[32m",
15 Color::Yellow => "\x1b[33m",
16 Color::Red => "\x1b[31m",
17 Color::Cyan => "\x1b[36m",
18 Color::Reset => "\x1b[0m",
19 };
20 }
21}