I have an old project where I used to insert ansi codes into println!() like this:
// ANSI colors for Linux terminal
pub const YELLOW: &str = "\x1b[33m";
pub const GREEN: &str = "\x1b[32m";
pub const RESET: &str = "\x1b[0m";
println!(r#"{YELLOW} Yellow {RESET} White {GREEN} Green {RESET}"#);
I struggled to find documentation how to do the same with crossterm.
I discovered it on my own and I would like to add it to the documentation of Module crossterm::style.
println!(r#"{yellow} Yellow {reset} White {green} Green {reset}"#,
green= crossterm::style::SetForegroundColor(crossterm::style::Color::Green),
yellow= crossterm::style::SetForegroundColor(crossterm::style::Color::Yellow),
reset= crossterm::style::ResetColor,
);
May I write a PR just for the doc-comments?
//! Displayable:
//!
//! SetForegroundColor() can be used in println! macro like:
//!
//! println!(r#"{yellow} Yellow {reset} White {green} Green {reset}"#,
//! green= crossterm::style::SetForegroundColor(crossterm::style::Color::Green),
//! yellow= crossterm::style::SetForegroundColor(crossterm::style::Color::Yellow),
//! reset= crossterm::style::ResetColor,
//! );
I have an old project where I used to insert ansi codes into
println!()
like this:I struggled to find documentation how to do the same with crossterm. I discovered it on my own and I would like to add it to the documentation of Module crossterm::style.
May I write a PR just for the doc-comments?