custom/
custom.rs

1extern crate term_painter;
2
3use term_painter::ToStyle;
4use term_painter::Color::Custom;
5use term_painter::Attr::Plain;
6
7fn main() {
8    // print 16 colors each line
9    for line in 0..16 {
10        // foreground
11        print!("FG:  ");
12        for c in (0..16).map(|i| 16*line + i) {
13            print!("{: <2x} ", Custom(c).paint(c));
14        }
15        println!("");
16
17        // background
18        print!("BG:  ");
19        for c in (0..16).map(|i| 16*line + i) {
20            print!("{: <2x} ", Plain.bg(Custom(c)).paint(c));
21        }
22        println!("");
23    }
24}