Colors in text
Today I'm testing text_colorizer
In cargo.toml:
[dependencies]
text-colorizer="*"
and the source code:
extern crate text_colorizer; use text_colorizer::*; fn main() { let blue_world = "Hello, world!".blue().bold().italic(); println!("{}", blue_world); println!("{:#?}", blue_world); }
gets us:
Hello, world! <- This part is blue, shiny and italic.
ColoredString {
input: "Hello, world!",
fgcolor: Some(
Blue,
),
bgcolor: None,
style: Style(
9,
),
}
Another one: ansi_term: ansi_term
In cargo.toml:
[dependencies]
ansi_term="*"
use ansi_term::Colour::*; fn main() { let red_world = Red.bold().italic().paint("Hello world!"); println!("{}", red_world); println!("{:#?}", red_world); }