decorations/
decorations.rs

1use termio::*;
2
3fn main() {
4    let mut parser = Termio::new();
5    
6    let tcss = r#"
7        @element "bold" {
8            decoration: bold;
9            color: green;
10        }
11        @element "italic" {
12            decoration: italic;
13            color: blue;
14        }
15        @element "underline" {
16            decoration: underline;
17            color: cyan;
18        }
19        @element "multiple" {
20            decoration: bold italic underline;
21            color: magenta;
22        }
23        @element "fancy" {
24            decoration: bold italic underline overline;
25            color: yellow;
26        }
27        @element "reverse" {
28            decoration: reverse;
29            color: red;
30        }
31        @element "conceal" {
32            decoration: conceal;
33            color: white;
34        }
35        @element "strikethrough" {
36            decoration: strikethrough;
37            color: i-red;
38        }
39        @element "framed" {
40            decoration: framed;
41            color: i-green;
42        }
43        @element "encircled" {
44            decoration: encircled;
45            color: i-blue;
46        }
47        @element "all" {
48            decoration: bold italic underline overline blink rapid-blink reverse strikethrough framed encircled;
49            color: i-magenta;
50            background: black;
51        }
52    "#;
53
54    parser.parse(tcss).unwrap();
55
56    println!("Basic decorations:");
57    println!("{}", "Bold Text".style("bold", &parser));
58    println!("{}", "Italic Text".style("italic", &parser));
59    println!("{}", "Underlined Text".style("underline", &parser));
60    
61    println!("\nMultiple decorations:");
62    println!("{}", "Multiple Decorations".style("multiple", &parser));
63    println!("{}", "Fancy Text".style("fancy", &parser));
64    
65    println!("\nSpecial decorations:");
66    println!("{}", "Reversed Text".style("reverse", &parser));
67    println!("{}", "Concealed Text".style("conceal", &parser));
68    println!("{}", "Strikethrough Text".style("strikethrough", &parser));
69    println!("{}", "Framed Text".style("framed", &parser));
70    println!("{}", "Encircled Text".style("encircled", &parser));
71    println!("\nAll decorations combined:");
72    println!("{}", "All Decorations".style("all", &parser));
73}