implemented coloured output

This commit is contained in:
djaidjai committed 2023-02-08 18:40:01 +01:00
1 parent 87843b62a7
commit a943ae4ae4
1 file changed
+6 -3
+6 -3
View File
@@ -5,13 +5,16 @@ use std::process::exit;
use log::error; use log::error;
use crate::model_rgb_ascii::Ascii; use crate::model_rgb_ascii::Ascii;
//todo: take into consideration the in_colour flag
pub fn print_terminal(art: Vec<Vec<Ascii>>, in_colour: bool) { pub fn print_terminal(art: Vec<Vec<Ascii>>, in_colour: bool) {
for line in art { for line in art {
for ascii in line { for ascii in line {
print!("{}", ascii.char) if in_colour {
print!("{}{}", termion::color::Fg(termion::color::Rgb(ascii.rgb.r, ascii.rgb.g, ascii.rgb.b)), ascii.char);
} else {
print!("{}", ascii.char);
}
} }
println!(); println!("{}", termion::style::Reset);
} }
} }
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.