use ratatui::{style::Stylize, text::Line}; pub fn colorize<'a>(mut txt: &'a str, width: usize, out: &mut Line<'a>) { let mut color = false; if !txt.len().is_multiple_of(width) { *out += txt[..txt.len() % width].red(); color = !color; txt = &txt[txt.len() % width..]; } for _ in 0..txt.len() / width { if color { *out += txt[0..width].cyan(); } else { *out += txt[0..width].red(); } txt = &txt[width..]; color = !color; } }