console_utilities/color.rs
1pub struct RGB {
2 pub r: u8,
3 pub g: u8,
4 pub b: u8,
5}
6
7impl RGB {
8 pub fn new(r: u8, g: u8, b: u8) -> Self {
9 RGB { r, g, b }
10 }
11}
12
13pub fn set_text_color(color: RGB) {
14 print!("\x1b[38;2;{};{};{}m", color.r, color.g, color.b);
15}
16
17pub fn reset_text_color() {
18 print!("\x1b[0m");
19}