1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! A module containing style and color enums.

use std::fmt;

#[derive(Debug, Copy, Clone)]
pub enum Color {
    White,
    Black,
    Red,
    Green,
    Yellow,
    Blue,
    Magenta,
    Cyan,
    LightGray,
    DarkGray,
    LightRed,
    LightGreen,
    LightYellow,
    LightBlue,
    LightMagenta,
    LightCyan
}

impl fmt::Display for Color {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Color::White => write!(f, "\x1B[97m"),
            Color::Black => write!(f, "\x1B[30m"),
            Color::Red => write!(f, "\x1B[31m"),
            Color::Green => write!(f, "\x1B[32m"),
            Color::Yellow => write!(f, "\x1B[33m"),
            Color::Blue => write!(f, "\x1B[34m"),
            Color::Magenta => write!(f, "\x1B[35m"),
            Color::Cyan => write!(f, "\x1B[36m"),
            Color::LightGray => write!(f, "\x1B[37m"),
            Color::DarkGray => write!(f, "\x1B[90m"),
            Color::LightRed => write!(f, "\x1B[91m"),
            Color::LightGreen => write!(f, "\x1B[92m"),
            Color::LightYellow => write!(f, "\x1B[93m"),
            Color::LightBlue => write!(f, "\x1B[94m"),
            Color::LightMagenta => write!(f, "\x1B[95m"),
            Color::LightCyan => write!(f, "\x1B[96m")
        }
    }
}

pub enum Style {
    Normal, 
    Bold,
    Dim,
    Italic,
    Underlined,
    Blink,
    Reverse,
    Hidden,
    StrikeThrough,
}

impl fmt::Display for Style {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Style::Normal => write!(f, "\x1B[0m"),
            Style::Bold => write!(f, "\x1B[1m"),
            Style::Dim => write!(f, "\x1B[2m"),
            Style::Italic => write!(f, "\x1B[3m"),
            Style::Underlined => write!(f, "\x1B[4m"),
            Style::Blink => write!(f, "\x1B[5m"),
            Style::Reverse => write!(f, "\x1B[7m"),
            Style::Hidden => write!(f, "\x1B[8m"),
            Style::StrikeThrough => write!(f, "\x1B[9m"),
        }
    }
}