Debian Codegraph @

examples/nested_colors.rs

raw symbols SCIP
1 extern crate colored;
2
3 use colored::Colorize;
4
5 /*
6 * This example use colored strings in a nested way (at line 14). It shows that colored is able to
7 * keep the correct color on the “!lalalala” part.
8 */
9
10 fn main() {
11 let world = "world".bold();
12 let hello_world = format!("Hello, {world}!");
13 println!("{hello_world}");
14 let hello_world = format!("Hello, {world}!lalalala").red();
15 println!("{hello_world}");
16 }