small tweak to coloured output
This commit is contained in:
parent
a943ae4ae4
commit
5f01bfa485
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue