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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
pub use self::color::*;
pub use self::style::*;
pub use self::bg::*;

mod color {
    use crate::custom;
    
    pub enum Color {
        Default,
        Black,
        Red,
        Green,
        Yellow,
        Blue,
        Magenta,
        Cyan,
        LightGray,
        DarkGray,
        LightRed,
        LightGreen,
        LightYellow,
        LightBlue,
        LightMagenta,
        LightCyan,
        White,
    }
    
    impl custom::Style for Color {
        fn get_style_code(&self) -> String {
            match self {
                Color::Default => { "\x1b[0m".to_string() }
                Color::Black => { "\x1b[30m".to_string() }
                Color::Red => { "\x1b[31m".to_string() }
                Color::Green => { "\x1b[32m".to_string() }
                Color::Yellow => { "\x1b[33m".to_string() }
                Color::Blue => { "\x1b[34m".to_string() }
                Color::Magenta => { "\x1b[35m".to_string() }
                Color::Cyan => { "\x1b[36m".to_string() }
                Color::LightGray => { "\x1b[37m".to_string() }
                Color::DarkGray => { "\x1b[90m".to_string() }
                Color::LightRed => { "\x1b[91m".to_string() }
                Color::LightGreen => { "\x1b[92m".to_string() }
                Color::LightYellow => { "\x1b[93m".to_string() }
                Color::LightBlue => { "\x1b[94m".to_string() }
                Color::LightMagenta => { "\x1b[95m".to_string() }
                Color::LightCyan => { "\x1b[96m".to_string() }
                Color::White => { "\x1b[97m".to_string() }
            }
        }
    }
}

mod style {
    use crate::custom;
    
    pub enum Style {
        Bold,
        Dark,
        Italic,
        Underlined
    }
    
    impl custom::Style for Style {
        fn get_style_code(&self) -> String {
            match self {
                Self::Bold => "\x1b[1m".to_string(),
                Self::Dark => "\x1b[2m".to_string(),
                Self::Italic => "\x1b[3m".to_string(),
                Self::Underlined => "\x1b[4m".to_string(),
            }
        }
    }
}

mod bg {
    use crate::custom;
    
    pub enum Background {
        Any,
        Black,
        Red,
        Green,
        Yellow,
        Blue,
        Magenta,
        Cyan,
        LightGray,
        DarkGray,
        LightRed,
        LightGreen,
        LightYellow,
        LightBlue,
        LightMagenta,
        LightCyan,
        White,
    }
    
    impl custom::Style for Background {
        fn get_style_code(&self) -> String {
            match self {
                Self::Any => "\x1b[7m".to_string(),
                Self::Black => "\x1b[40m".to_string(),
                Self::Red => "\x1b[41m".to_string(),
                Self::Green => { "\x1b[42m".to_string() }
                Self::Yellow => { "\x1b[43m".to_string() }
                Self::Blue => { "\x1b[44m".to_string() }
                Self::Magenta => { "\x1b[45m".to_string() }
                Self::Cyan => { "\x1b[46m".to_string() }
                Self::LightGray => { "\x1b[47m".to_string() }
                Self::DarkGray => { "\x1b[100m".to_string() }
                Self::LightRed => { "\x1b[101m".to_string() }
                Self::LightGreen => { "\x1b[102m".to_string() }
                Self::LightYellow => { "\x1b[103m".to_string() }
                Self::LightBlue => { "\x1b[104m".to_string() }
                Self::LightMagenta => { "\x1b[105m".to_string() }
                Self::LightCyan => { "\x1b[106m".to_string() }
                Self::White => { "\x1b[107m".to_string() }
            }
        }
    }
}