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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
use std::fmt::Display; /// Get the text with black text /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::black("Hello"); /// println!("{}", text); /// ``` pub fn black<T: Display>(t: T) -> String { format!("\x1b[30m{}\x1b[0m", t) } /// Get the text with red text /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::red("Hello"); /// println!("{}", text); /// ``` pub fn red<T: Display>(t: T) -> String { format!("\x1b[31m{}\x1b[0m", t) } /// Get the text with green text /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::green("Hello"); /// println!("{}", text); /// ``` pub fn green<T: Display>(t: T) -> String { format!("\x1b[32m{}\x1b[0m", t) } /// Get the text with yellow text /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::yellow("Hello"); /// println!("{}", text); /// ``` pub fn yellow<T: Display>(t: T) -> String { format!("\x1b[33m{}\x1b[0m", t) } /// Get the text with blue text /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::blue("Hello"); /// println!("{}", text); /// ``` pub fn blue<T: Display>(t: T) -> String { format!("\x1b[34m{}\x1b[0m", t) } /// Get the text with magenta text /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::magenta("Hello"); /// println!("{}", text); /// ``` pub fn magenta<T: Display>(t: T) -> String { format!("\x1b[35m{}\x1b[0m", t) } /// Get the text with cyan text /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::cyan("Hello"); /// println!("{}", text); /// ``` pub fn cyan<T: Display>(t: T) -> String { format!("\x1b[36m{}\x1b[0m", t) } /// Get the text with white text /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::white("Hello"); /// println!("{}", text); /// ``` pub fn white<T: Display>(t: T) -> String { format!("\x1b[37m{}\x1b[0m", t) } /// Get text with black background /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::bg_black("Hello"); /// println!("{}", text); /// ``` pub fn bg_black<T: Display>(t: T) -> String { format!("\x1b[40m{}\x1b[0m", t) } /// Get text with red background /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::bg_red("Hello"); /// println!("{}", text); /// ``` pub fn bg_red<T: Display>(t: T) -> String { format!("\x1b[41m{}\x1b[0m", t) } /// Get text with green background /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::bg_green("Hello"); /// println!("{}", text); /// ``` pub fn bg_green<T: Display>(t: T) -> String { format!("\x1b[42m{}\x1b[0m", t) } /// Get text with yellow background /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::bg_yellow("Hello"); /// println!("{}", text); /// ``` pub fn bg_yellow<T: Display>(t: T) -> String { format!("\x1b[43m{}\x1b[0m", t) } /// Get text with blue background /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::bg_blue("Hello"); /// println!("{}", text); /// ``` pub fn bg_blue<T: Display>(t: T) -> String { format!("\x1b[44m{}\x1b[0m", t) } /// Get text with magenta background /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::bg_magenta("Hello"); /// println!("{}", text); /// ``` pub fn bg_magenta<T: Display>(t: T) -> String { format!("\x1b[45m{}\x1b[0m", t) } /// Get text with cyan background /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::bg_cyan("Hello"); /// println!("{}", text); /// ``` pub fn bg_cyan<T: Display>(t: T) -> String { format!("\x1b[46m{}\x1b[0m", t) } /// Get text with white background /// /// Example /// ``` /// use seahorse::color; /// /// let text = color::bg_white("Hello"); /// println!("{}", text); /// ``` pub fn bg_white<T: Display>(t: T) -> String { format!("\x1b[47m{}\x1b[0m", t) }