File: nested_colors.rs

package info (click to toggle)
rust-colored 3.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 444 kB
  • sloc: makefile: 2
file content (16 lines) | stat: -rw-r--r-- 432 bytes parent folder | download | duplicates (26)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate colored;

use colored::*;

/*
 * This example use colored strings in a nested way (at line 14). It shows that colored is able to
 * keep the correct color on the “!lalalala” part.
 */

fn main() {
    let world = "world".bold();
    let hello_world = format!("Hello, {}!", world);
    println!("{}", hello_world);
    let hello_world = format!("Hello, {}!lalalala", world).red();
    println!("{}", hello_world);
}