use std::fmt; #[derive(Clone, Debug)] pub struct Style(u8, u8, u8); impl fmt::Display for Style { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let Style(color, bright, shade) = self; let bright_str: String = if *bright > 0 { String::from(";") + &bright.to_string() } else { String::from("") }; let shade_str: String = if *shade > 0 { String::from(";") + &shade.to_string() } else { String::from("") }; let mut style = String::from("\x1b["); style.push_str(&color.to_string()); style.push_str(&bright_str); style.push_str(&shade_str); style.push_str("m"); write!(f, "{}", style) } } #[derive(Debug)] pub struct Cell { pub styles: Vec