#[allow(dead_code)]
#[derive(Clone, Copy)]
pub enum Color {
Black,
Red,
Green,
Yellow,
Blue,
Magenta,
Cyan,
White,
Gray,
BrightRed,
BrightGreen,
BrigthYellow,
BrightBlue,
BrightMagenta,
BrightCyan,
BrightWhite,
}
impl Color {
pub fn reset() -> &'static str {
"\x1b[0m"
}
pub fn text(&self, t: &str) -> String {
format!("{}{}\x1b[0m", self.code(), t)
}
pub fn code(&self) -> &str {
match self {
Color::Black => "\x1b[30m",
Color::Red => "\x1b[31m",
Color::Green => "\x1b[32m",
Color::Yellow => "\x1b[33m",
Color::Blue => "\x1b[34m",
Color::Magenta => "\x1b[35m",
Color::Cyan => "\x1b[36m",
Color::White => "\x1b[37m",
Color::Gray => "\x1b[90m",
Color::BrightRed => "\x1b[91m",
Color::BrightGreen => "\x1b[92m",
Color::BrigthYellow => "\x1b[93m",
Color::BrightBlue => "\x1b[94m",
Color::BrightMagenta => "\x1b[95m",
Color::BrightCyan => "\x1b[96m",
Color::BrightWhite => "\x1b[97m",
}
}
}