small tweak to coloured output

This commit is contained in:
Djairo Hougee 2023-02-08 18:41:43 +01:00
parent a943ae4ae4
commit 5f01bfa485
1 changed files with 3 additions and 2 deletions

View File

@ -3,18 +3,19 @@ use std::io::Write;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::exit; use std::process::exit;
use log::error; use log::error;
use termion::{color, style};
use crate::model_rgb_ascii::Ascii; use crate::model_rgb_ascii::Ascii;
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 {
if in_colour { if in_colour {
print!("{}{}", termion::color::Fg(termion::color::Rgb(ascii.rgb.r, ascii.rgb.g, ascii.rgb.b)), ascii.char); print!("{}{}", color::Fg(color::Rgb(ascii.rgb.r, ascii.rgb.g, ascii.rgb.b)), ascii.char);
} else { } else {
print!("{}", ascii.char); print!("{}", ascii.char);
} }
} }
println!("{}", termion::style::Reset); println!("{}", style::Reset);
} }
} }