use std::fmt; use unicode_width::UnicodeWidthStr; #[derive(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 mut style = String::from("\x1b["); style.push_str(&color.to_string()); if *bright > 0 { style.push_str(";"); style.push_str(&bright.to_string()); }; if *shade > 0 { style.push_str(";"); style.push_str(&shade.to_string()); }; style.push_str("m"); write!(f, "{}", style) } } #[derive(Debug)] pub struct Cell { styles: Vec