console/console.rs
1use ansi_style::{Color, Style};
2
3fn main() {
4 // You can either color the text directly with the Color enumeration
5 println!(
6 "{}Cyan colored \"Hello World!\"{}",
7 Color::Cyan.open(),
8 Color::Cyan.close()
9 );
10
11 // or you can use the builder function from within the Style stuct
12 // to create a style that can be used for more than one instance of
13 // a string and you wouldn't need to have an open and close function
14 // prepended and appended to every text you type like the above example
15
16 let style = Style::builder().red().strikethrough().build();
17
18 println!("{}", style.stylize("Hello World in red with strikethrough"));
19
20 println!("This is in red: {}", Color::Red.paint("a red string"));
21}