comprehensive_demo/
comprehensive_demo.rs

1use tinterm::*;
2
3fn main() {
4    println!("🎨 Tinterm Comprehensive Demo 🎨\n");
5
6    // Section 1: Basic Colors
7    println!("=== 1. BASIC COLORS ===");
8    println!("{}", "Red Text".color(Color::RED));
9    println!("{}", "Green Background".bg(Color::GREEN));
10    println!("{}", "Blue on Yellow".fg(Color::BLUE).bg(Color::YELLOW));
11    println!("{}", "Custom RGB Color".color(Color::new(255, 165, 0))); // Orange
12    println!("{}", "Hex Color".color(Color::from_hex("#FF69B4").unwrap())); // Hot Pink
13    println!();
14
15    // Section 2: Text Styling
16    println!("=== 2. TEXT STYLING ===");
17    println!("{}", "Bold Text".bold());
18    println!("{}", "Italic Text".italic());
19    println!("{}", "Underlined Text".underline());
20    println!("{}", "Strikethrough Text".strikethrough());
21    println!("{}", "Dim Text".dim());
22    println!("{}", "Bright Text".bright());
23    println!("{}", "Reversed Text".reverse());
24    println!("{}", "Blinking Text".blink());
25    println!();
26
27    // Section 3: Method Chaining
28    println!("=== 3. METHOD CHAINING ===");
29    println!(
30        "{}",
31        "Bold Red on Blue".bold().color(Color::RED).bg(Color::BLUE)
32    );
33    println!(
34        "{}",
35        "Italic Underlined Green"
36            .italic()
37            .underline()
38            .color(Color::GREEN)
39    );
40    println!(
41        "{}",
42        "Bright Magenta with Cyan BG"
43            .bright()
44            .color(Color::MAGENTA)
45            .bg(Color::CYAN)
46    );
47    println!();
48
49    // Section 4: Gradients
50    println!("=== 4. GRADIENTS ===");
51    println!("Foreground Gradients:");
52    println!(
53        "{}",
54        "Red to Blue Gradient".gradient(Color::RED, Color::BLUE, None)
55    );
56    println!(
57        "{}",
58        "Green to Purple Gradient".gradient(Color::GREEN, Color::PURPLE, None)
59    );
60    println!(
61        "{}",
62        "Sunset Colors".gradient(Color::ORANGE, Color::DEEP_PINK, None)
63    );
64
65    println!("\nBackground Gradients:");
66    println!(
67        "{}",
68        "Ocean Waves".gradient_bg(Color::DEEP_SKY_BLUE, Color::TEAL, None)
69    );
70    println!(
71        "{}",
72        "Forest Floor".gradient_bg(Color::DARK_GREEN, Color::BROWN, None)
73    );
74
75    println!("\nMultiline Gradients:");
76    let multiline = "Line One\nLine Two\nLine Three";
77    println!("Block mode (each line separate):");
78    println!(
79        "{}",
80        multiline.gradient(Color::RED, Color::BLUE, Some(true))
81    );
82    println!("Continuous mode (across lines):");
83    println!(
84        "{}",
85        multiline.gradient(Color::CYAN, Color::MAGENTA, Some(false))
86    );
87    println!();
88
89    // Section 5: Shimmer Effects
90    println!("=== 5. SHIMMER EFFECTS ===");
91    println!("Static Shimmer Renders:");
92    println!(
93        "{}",
94        "✨ Golden Shimmer ✨"
95            .shimmer(Color::GOLD, None)
96            .static_render()
97    );
98    println!(
99        "{}",
100        "💎 Diamond Shine 💎".shine(Color::WHITE).static_render()
101    );
102    println!(
103        "{}",
104        "🌟 Stellar Glow 🌟"
105            .glow(Color::YELLOW, 200)
106            .static_render()
107    );
108    println!(
109        "{}",
110        "🌈 Rainbow Gradient 🌈"
111            .shimmer_gradient(Color::RED, Color::VIOLET, None)
112            .static_render()
113    );
114    println!();
115
116    // Section 6: Predefined Colors Showcase
117    println!("=== 6. PREDEFINED COLORS SHOWCASE ===");
118    let colors = vec![
119        ("Fire", Color::RED),
120        ("Ocean", Color::BLUE),
121        ("Forest", Color::GREEN),
122        ("Sun", Color::YELLOW),
123        ("Lavender", Color::LAVENDER),
124        ("Coral", Color::CORAL),
125        ("Gold", Color::GOLD),
126        ("Silver", Color::SILVER),
127        ("Rose", Color::HOT_PINK),
128        ("Emerald", Color::LIME_GREEN),
129    ];
130
131    for (name, color) in colors {
132        println!("{}", format!("● {}", name).color(color));
133    }
134    println!();
135
136    // Section 7: Creative Combinations
137    println!("=== 7. CREATIVE COMBINATIONS ===");
138
139    // Logo-style text
140    println!(
141        "{}",
142        "T".color(Color::RED).to_string()
143            + &"I".color(Color::ORANGE).to_string()
144            + &"N".color(Color::YELLOW).to_string()
145            + &"T".color(Color::GREEN).to_string()
146            + &"E".color(Color::BLUE).to_string()
147            + &"R".color(Color::INDIGO).to_string()
148            + &"M".color(Color::VIOLET)
149    );
150
151    // Progress bar simulation
152    let _progress_full = "████████████████████";
153    let _progress_empty = "░░░░░░░░░░░░░░░░░░░░";
154    println!(
155        "Progress: [{}{}] 75%",
156        "███████████████".bg(Color::GREEN),
157        "░░░░░".color(Color::DARK_GRAY)
158    );
159
160    // Status indicators
161    println!("Status: {} Ready", "●".color(Color::GREEN));
162    println!("Status: {} Warning", "●".color(Color::YELLOW));
163    println!("Status: {} Error", "●".color(Color::RED));
164
165    // Syntax highlighting simulation
166    println!("\nSyntax Highlighting Example:");
167    println!(
168        "{} {} {} {}{}{}",
169        "fn".color(Color::PURPLE),
170        "main".color(Color::BLUE),
171        "()".color(Color::YELLOW),
172        "{".color(Color::WHITE),
173        "\n    println!".color(Color::CYAN),
174        "();".color(Color::WHITE)
175    );
176    println!("{}", "}".color(Color::WHITE));
177    println!();
178
179    // Section 8: Performance Test
180    println!("=== 8. PERFORMANCE TEST ===");
181    let start = std::time::Instant::now();
182    for i in 0..1000 {
183        let _colored = format!("Line {}", i).color(Color::BLUE);
184    }
185    let duration = start.elapsed();
186    println!("Rendered 1000 colored strings in: {:?}", duration);
187
188    // Final showcase
189    println!(
190        "\n{}",
191        "🎉 Tinterm Demo Complete! 🎉".gradient(Color::RED, Color::BLUE, None)
192    );
193    println!(
194        "{}",
195        "Thank you for using Tinterm!"
196            .shimmer(Color::GOLD, None)
197            .static_render()
198    );
199}