pub struct ShimmerText { /* private fields */ }Implementations§
Source§impl ShimmerText
impl ShimmerText
Sourcepub fn speed(self, millis: u64) -> Self
pub fn speed(self, millis: u64) -> Self
Examples found in repository?
examples/animation_test.rs (line 7)
3fn main() {
4 println!("Testing shimmer animation:");
5 println!("Watch the text below for a moving bright highlight...\n");
6
7 let shimmer = "★ SHIMMERING TEXT ★".shimmer(Color::GOLD, None).speed(200);
8
9 print!("Animating: ");
10 shimmer.animate(5);
11
12 println!("\nShine effect:");
13 print!("Animating: ");
14 let shine = "✨ SHINING TEXT ✨".shine(Color::CYAN).speed(180);
15 shine.animate(3);
16
17 println!("\nGlow effect:");
18 print!("Animating: ");
19 let glow = "💫 GLOWING TEXT 💫".glow(Color::PURPLE, 200).speed(250);
20 glow.animate(4);
21
22 println!("\nAnimation test complete!");
23}More examples
examples/cli_tools.rs (line 170)
157fn simulate_deployment() {
158 println!("{}", "Deployment Simulation".bold().color(Color::WHITE));
159 println!("{}", "=".repeat(50).color(Color::GRAY));
160
161 let stages = vec![
162 ("Preparing deployment", Color::BLUE),
163 ("Building Docker image", Color::PURPLE),
164 ("Pushing to registry", Color::ORANGE),
165 ("Updating configuration", Color::YELLOW),
166 ("Rolling out to servers", Color::GREEN),
167 ];
168
169 for (stage, color) in stages {
170 let shimmer = format!("🚀 {}", stage).shimmer(color, None).speed(100);
171 print!(" ");
172 shimmer.animate(2);
173 thread::sleep(Duration::from_millis(500));
174 }
175
176 println!();
177 println!(
178 "{}",
179 "🎉 Deployment successful! 🎉"
180 .glow(Color::GREEN, 255)
181 .static_render()
182 );
183}examples/simple_animation.rs (line 24)
3fn main() {
4 println!("Simple Animation Test");
5 println!("===================");
6
7 // Test static rendering first
8 println!("\n1. Static shimmer rendering:");
9 println!("{}", "✨ Static Shimmer ✨".shimmer(Color::GOLD, None).static_render());
10
11 println!("\n2. Static shine rendering:");
12 println!("{}", "⭐ Static Shine ⭐".shine(Color::CYAN).static_render());
13
14 println!("\n3. Static glow rendering:");
15 println!("{}", "💫 Static Glow 💫".glow(Color::PURPLE, 200).static_render());
16
17 println!("\n4. Basic colors work:");
18 println!("{}", "Red Text".color(Color::RED));
19 println!("{}", "Blue Text".color(Color::BLUE));
20 println!("{}", "Green Text".color(Color::GREEN));
21
22 println!("\n5. Now testing short animation (2 seconds):");
23 print!("Animating: ");
24 "SHIMMER".shimmer(Color::RED, None).speed(300).animate(2);
25
26 println!("Test complete!");
27}examples/shimmer_showcase.rs (line 46)
5fn main() {
6 println!("🌟 Tinterm Shimmer Showcase 🌟\n");
7
8 // Basic shimmer effect
9 println!("1. Basic Shimmer Effect:");
10 let shimmer = "✨ Shimmering Text ✨".shimmer(Color::GOLD, None);
11 println!(" Static: {}", shimmer.static_render());
12 print!(" Animated: ");
13 shimmer.animate(3);
14 println!();
15
16 // Shine effect with different colors
17 println!("2. Shine Effect:");
18 let shine_red = "🔥 Blazing Fire 🔥".shine(Color::RED);
19 let shine_blue = "💎 Crystal Blue 💎".shine(Color::CYAN);
20 let shine_green = "🌿 Forest Green 🌿".shine(Color::GREEN);
21
22 println!(" Static renders:");
23 println!(" {}", shine_red.static_render());
24 println!(" {}", shine_blue.static_render());
25 println!(" {}", shine_green.static_render());
26
27 print!(" Animated shine: ");
28 shine_red.animate(2);
29 println!();
30
31 // Glow effect with different intensities
32 println!("3. Glow Effect:");
33 let glow_soft = "🌙 Soft Moonlight 🌙".glow(Color::LIGHT_BLUE, 150);
34 let glow_medium = "⭐ Bright Star ⭐".glow(Color::YELLOW, 200);
35 let glow_intense = "☀️ Blazing Sun ☀️".glow(Color::ORANGE, 255);
36
37 println!(" Static renders:");
38 println!(" {}", glow_soft.static_render());
39 println!(" {}", glow_medium.static_render());
40 println!(" {}", glow_intense.static_render());
41
42 // Shimmer with background colors
43 println!("4. Shimmer with Background:");
44 let bg_shimmer = "🎨 Art on Canvas 🎨"
45 .shimmer(Color::WHITE, Some(Color::DARK_BLUE))
46 .speed(80);
47 print!(" ");
48 bg_shimmer.animate(3);
49 println!();
50
51 // Gradient shimmer
52 println!("5. Gradient Shimmer:");
53 let gradient_shimmer = "🌈 Rainbow Bridge 🌈"
54 .shimmer_gradient(Color::RED, Color::VIOLET, None)
55 .speed(120);
56 print!(" ");
57 gradient_shimmer.animate(3);
58 println!();
59
60 // Custom speed demonstration
61 println!("6. Speed Variations:");
62 let fast = "⚡ Lightning Fast ⚡"
63 .shimmer(Color::YELLOW, None)
64 .speed(50);
65 let slow = "🐌 Slow and Steady 🐌"
66 .shimmer(Color::GREEN, None)
67 .speed(200);
68
69 print!(" Fast: ");
70 fast.animate(2);
71 print!(" Slow: ");
72 slow.animate(2);
73 println!();
74
75 // Combining with other text effects
76 println!("7. Combined Effects:");
77 let bold_shimmer = "💪 Bold Shimmer 💪".bold().shimmer(Color::RED, None);
78 let italic_glow = "💫 Italic Glow 💫".italic().glow(Color::PURPLE, 180);
79
80 println!(" {}", bold_shimmer.static_render());
81 println!(" {}", italic_glow.static_render());
82
83 // Multi-line shimmer
84 println!("8. Multi-line Effects:");
85 let multiline = "🚀 Launch Sequence\n⭐ Stars Aligning\n🌙 Mission Success";
86 let multiline_shimmer = multiline.shimmer(Color::CYAN, Some(Color::DARK_BLUE));
87 print!(" ");
88 multiline_shimmer.animate(2);
89 println!();
90
91 // Performance showcase
92 println!("9. Performance Showcase - Multiple Effects:");
93 let effects = vec![
94 "🎯 Target Acquired".shimmer(Color::RED, None),
95 "🔍 Scanning...".shine(Color::GREEN),
96 "📡 Signal Strong".glow(Color::BLUE, 200),
97 "✅ Mission Complete".shimmer_gradient(Color::GREEN, Color::LIME, None),
98 ];
99
100 for (i, effect) in effects.iter().enumerate() {
101 print!(" Effect {}: ", i + 1);
102 effect.clone().speed(60).animate(1);
103 thread::sleep(Duration::from_millis(200));
104 }
105
106 println!("\n🎉 Shimmer showcase complete! 🎉");
107}pub fn background(self, color: Color) -> Self
pub fn intensity(self, intensity: u8) -> Self
Sourcepub fn animate(&self, duration_secs: u64)
pub fn animate(&self, duration_secs: u64)
Examples found in repository?
examples/animation_test.rs (line 10)
3fn main() {
4 println!("Testing shimmer animation:");
5 println!("Watch the text below for a moving bright highlight...\n");
6
7 let shimmer = "★ SHIMMERING TEXT ★".shimmer(Color::GOLD, None).speed(200);
8
9 print!("Animating: ");
10 shimmer.animate(5);
11
12 println!("\nShine effect:");
13 print!("Animating: ");
14 let shine = "✨ SHINING TEXT ✨".shine(Color::CYAN).speed(180);
15 shine.animate(3);
16
17 println!("\nGlow effect:");
18 print!("Animating: ");
19 let glow = "💫 GLOWING TEXT 💫".glow(Color::PURPLE, 200).speed(250);
20 glow.animate(4);
21
22 println!("\nAnimation test complete!");
23}More examples
examples/cli_tools.rs (line 172)
157fn simulate_deployment() {
158 println!("{}", "Deployment Simulation".bold().color(Color::WHITE));
159 println!("{}", "=".repeat(50).color(Color::GRAY));
160
161 let stages = vec![
162 ("Preparing deployment", Color::BLUE),
163 ("Building Docker image", Color::PURPLE),
164 ("Pushing to registry", Color::ORANGE),
165 ("Updating configuration", Color::YELLOW),
166 ("Rolling out to servers", Color::GREEN),
167 ];
168
169 for (stage, color) in stages {
170 let shimmer = format!("🚀 {}", stage).shimmer(color, None).speed(100);
171 print!(" ");
172 shimmer.animate(2);
173 thread::sleep(Duration::from_millis(500));
174 }
175
176 println!();
177 println!(
178 "{}",
179 "🎉 Deployment successful! 🎉"
180 .glow(Color::GREEN, 255)
181 .static_render()
182 );
183}examples/simple_animation.rs (line 24)
3fn main() {
4 println!("Simple Animation Test");
5 println!("===================");
6
7 // Test static rendering first
8 println!("\n1. Static shimmer rendering:");
9 println!("{}", "✨ Static Shimmer ✨".shimmer(Color::GOLD, None).static_render());
10
11 println!("\n2. Static shine rendering:");
12 println!("{}", "⭐ Static Shine ⭐".shine(Color::CYAN).static_render());
13
14 println!("\n3. Static glow rendering:");
15 println!("{}", "💫 Static Glow 💫".glow(Color::PURPLE, 200).static_render());
16
17 println!("\n4. Basic colors work:");
18 println!("{}", "Red Text".color(Color::RED));
19 println!("{}", "Blue Text".color(Color::BLUE));
20 println!("{}", "Green Text".color(Color::GREEN));
21
22 println!("\n5. Now testing short animation (2 seconds):");
23 print!("Animating: ");
24 "SHIMMER".shimmer(Color::RED, None).speed(300).animate(2);
25
26 println!("Test complete!");
27}examples/shimmer_showcase.rs (line 13)
5fn main() {
6 println!("🌟 Tinterm Shimmer Showcase 🌟\n");
7
8 // Basic shimmer effect
9 println!("1. Basic Shimmer Effect:");
10 let shimmer = "✨ Shimmering Text ✨".shimmer(Color::GOLD, None);
11 println!(" Static: {}", shimmer.static_render());
12 print!(" Animated: ");
13 shimmer.animate(3);
14 println!();
15
16 // Shine effect with different colors
17 println!("2. Shine Effect:");
18 let shine_red = "🔥 Blazing Fire 🔥".shine(Color::RED);
19 let shine_blue = "💎 Crystal Blue 💎".shine(Color::CYAN);
20 let shine_green = "🌿 Forest Green 🌿".shine(Color::GREEN);
21
22 println!(" Static renders:");
23 println!(" {}", shine_red.static_render());
24 println!(" {}", shine_blue.static_render());
25 println!(" {}", shine_green.static_render());
26
27 print!(" Animated shine: ");
28 shine_red.animate(2);
29 println!();
30
31 // Glow effect with different intensities
32 println!("3. Glow Effect:");
33 let glow_soft = "🌙 Soft Moonlight 🌙".glow(Color::LIGHT_BLUE, 150);
34 let glow_medium = "⭐ Bright Star ⭐".glow(Color::YELLOW, 200);
35 let glow_intense = "☀️ Blazing Sun ☀️".glow(Color::ORANGE, 255);
36
37 println!(" Static renders:");
38 println!(" {}", glow_soft.static_render());
39 println!(" {}", glow_medium.static_render());
40 println!(" {}", glow_intense.static_render());
41
42 // Shimmer with background colors
43 println!("4. Shimmer with Background:");
44 let bg_shimmer = "🎨 Art on Canvas 🎨"
45 .shimmer(Color::WHITE, Some(Color::DARK_BLUE))
46 .speed(80);
47 print!(" ");
48 bg_shimmer.animate(3);
49 println!();
50
51 // Gradient shimmer
52 println!("5. Gradient Shimmer:");
53 let gradient_shimmer = "🌈 Rainbow Bridge 🌈"
54 .shimmer_gradient(Color::RED, Color::VIOLET, None)
55 .speed(120);
56 print!(" ");
57 gradient_shimmer.animate(3);
58 println!();
59
60 // Custom speed demonstration
61 println!("6. Speed Variations:");
62 let fast = "⚡ Lightning Fast ⚡"
63 .shimmer(Color::YELLOW, None)
64 .speed(50);
65 let slow = "🐌 Slow and Steady 🐌"
66 .shimmer(Color::GREEN, None)
67 .speed(200);
68
69 print!(" Fast: ");
70 fast.animate(2);
71 print!(" Slow: ");
72 slow.animate(2);
73 println!();
74
75 // Combining with other text effects
76 println!("7. Combined Effects:");
77 let bold_shimmer = "💪 Bold Shimmer 💪".bold().shimmer(Color::RED, None);
78 let italic_glow = "💫 Italic Glow 💫".italic().glow(Color::PURPLE, 180);
79
80 println!(" {}", bold_shimmer.static_render());
81 println!(" {}", italic_glow.static_render());
82
83 // Multi-line shimmer
84 println!("8. Multi-line Effects:");
85 let multiline = "🚀 Launch Sequence\n⭐ Stars Aligning\n🌙 Mission Success";
86 let multiline_shimmer = multiline.shimmer(Color::CYAN, Some(Color::DARK_BLUE));
87 print!(" ");
88 multiline_shimmer.animate(2);
89 println!();
90
91 // Performance showcase
92 println!("9. Performance Showcase - Multiple Effects:");
93 let effects = vec![
94 "🎯 Target Acquired".shimmer(Color::RED, None),
95 "🔍 Scanning...".shine(Color::GREEN),
96 "📡 Signal Strong".glow(Color::BLUE, 200),
97 "✅ Mission Complete".shimmer_gradient(Color::GREEN, Color::LIME, None),
98 ];
99
100 for (i, effect) in effects.iter().enumerate() {
101 print!(" Effect {}: ", i + 1);
102 effect.clone().speed(60).animate(1);
103 thread::sleep(Duration::from_millis(200));
104 }
105
106 println!("\n🎉 Shimmer showcase complete! 🎉");
107}Sourcepub fn static_render(&self) -> String
pub fn static_render(&self) -> String
Examples found in repository?
More examples
examples/cli_tools.rs (line 181)
157fn simulate_deployment() {
158 println!("{}", "Deployment Simulation".bold().color(Color::WHITE));
159 println!("{}", "=".repeat(50).color(Color::GRAY));
160
161 let stages = vec![
162 ("Preparing deployment", Color::BLUE),
163 ("Building Docker image", Color::PURPLE),
164 ("Pushing to registry", Color::ORANGE),
165 ("Updating configuration", Color::YELLOW),
166 ("Rolling out to servers", Color::GREEN),
167 ];
168
169 for (stage, color) in stages {
170 let shimmer = format!("🚀 {}", stage).shimmer(color, None).speed(100);
171 print!(" ");
172 shimmer.animate(2);
173 thread::sleep(Duration::from_millis(500));
174 }
175
176 println!();
177 println!(
178 "{}",
179 "🎉 Deployment successful! 🎉"
180 .glow(Color::GREEN, 255)
181 .static_render()
182 );
183}
184
185fn simulate_monitoring_dashboard() {
186 println!("{}", "Monitoring Dashboard".bold().color(Color::WHITE));
187 println!("{}", "=".repeat(50).color(Color::GRAY));
188
189 // System status
190 println!("{}", "System Status:".color(Color::CYAN).bold());
191 println!(
192 " CPU Usage: {} {}%",
193 "●".color(Color::GREEN),
194 "23".color(Color::WHITE)
195 );
196 println!(
197 " Memory Usage: {} {}%",
198 "●".color(Color::YELLOW),
199 "67".color(Color::WHITE)
200 );
201 println!(
202 " Disk Usage: {} {}%",
203 "●".color(Color::RED),
204 "89".color(Color::WHITE)
205 );
206 println!(" Network: {} Active", "●".color(Color::GREEN));
207 println!();
208
209 // Service status
210 println!("{}", "Services:".color(Color::CYAN).bold());
211 let services = vec![
212 ("Web Server", Color::GREEN, "Running"),
213 ("Database", Color::GREEN, "Running"),
214 ("Cache", Color::YELLOW, "Warning"),
215 ("Queue", Color::GREEN, "Running"),
216 ("API Gateway", Color::RED, "Error"),
217 ];
218
219 for (service, color, status) in services {
220 println!(
221 " {:<15} {} {}",
222 service.color(Color::WHITE),
223 "●".color(color),
224 status.color(color)
225 );
226 }
227 println!();
228
229 // Performance metrics with visual bars
230 println!("{}", "Performance Metrics:".color(Color::CYAN).bold());
231
232 let metrics = vec![
233 ("Requests/sec", 85, Color::GREEN),
234 ("Response time", 45, Color::YELLOW),
235 ("Error rate", 15, Color::RED),
236 ("Throughput", 92, Color::GREEN),
237 ];
238
239 for (metric, value, color) in metrics {
240 let bars = "█".repeat(value / 5);
241 let empty = "░".repeat(20 - value / 5);
242 println!(
243 " {:<15} [{}{}] {}%",
244 metric.color(Color::WHITE),
245 bars.color(color),
246 empty.color(Color::DARK_GRAY),
247 value.to_string().color(color)
248 );
249 }
250
251 println!();
252
253 // Alert simulation
254 let alert = "🚨 High memory usage detected! 🚨".glow(Color::RED, 255);
255 println!("{}", alert.static_render());
256
257 println!();
258 println!(
259 "{}",
260 "Dashboard updated"
261 .shimmer(Color::CYAN, None)
262 .static_render()
263 );
264}examples/simple_animation.rs (line 9)
3fn main() {
4 println!("Simple Animation Test");
5 println!("===================");
6
7 // Test static rendering first
8 println!("\n1. Static shimmer rendering:");
9 println!("{}", "✨ Static Shimmer ✨".shimmer(Color::GOLD, None).static_render());
10
11 println!("\n2. Static shine rendering:");
12 println!("{}", "⭐ Static Shine ⭐".shine(Color::CYAN).static_render());
13
14 println!("\n3. Static glow rendering:");
15 println!("{}", "💫 Static Glow 💫".glow(Color::PURPLE, 200).static_render());
16
17 println!("\n4. Basic colors work:");
18 println!("{}", "Red Text".color(Color::RED));
19 println!("{}", "Blue Text".color(Color::BLUE));
20 println!("{}", "Green Text".color(Color::GREEN));
21
22 println!("\n5. Now testing short animation (2 seconds):");
23 print!("Animating: ");
24 "SHIMMER".shimmer(Color::RED, None).speed(300).animate(2);
25
26 println!("Test complete!");
27}examples/art_and_logos.rs (line 52)
34fn display_tinterm_logo() {
35 println!("Tinterm Logo:");
36 let logo = r#"
37 ████████ ██ ███ ██ ████████ ███████ ████████ ███ ███
38 ██ ██ ████ ██ ██ ██ ██ ████ ████
39 ██ ██ ██ ██ ██ ██ █████ ██ ██ ████ ██
40 ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
41 ██ ██ ██ ████ ██ ███████ ██ ██ ██
42"#;
43
44 // Apply gradient to the logo
45 println!("{}", logo.gradient(Color::CYAN, Color::MAGENTA, Some(true)));
46
47 // Subtitle with shimmer
48 println!(
49 " {}\n",
50 "✨ Tinted Terminal Colors ✨"
51 .shimmer(Color::GOLD, None)
52 .static_render()
53 );
54}
55
56fn display_rainbow_text() {
57 println!("Rainbow Effects:");
58
59 // Letter-by-letter rainbow
60 let text = "RAINBOW";
61 let colors = vec![
62 Color::RED,
63 Color::ORANGE,
64 Color::YELLOW,
65 Color::GREEN,
66 Color::BLUE,
67 Color::INDIGO,
68 Color::VIOLET,
69 ];
70
71 let mut rainbow = String::new();
72 for (i, ch) in text.chars().enumerate() {
73 rainbow.push_str(&ch.to_string().color(colors[i % colors.len()]));
74 }
75 println!(" Letter Rainbow: {}", rainbow);
76
77 // Gradient rainbow
78 println!(
79 " Gradient Rainbow: {}",
80 "🌈 RAINBOW GRADIENT 🌈".gradient(Color::RED, Color::VIOLET, None)
81 );
82
83 // Shimmer rainbow
84 println!(
85 " Shimmer Rainbow: {}",
86 "✨ SHIMMERING RAINBOW ✨"
87 .shimmer_gradient(Color::RED, Color::VIOLET, None)
88 .static_render()
89 );
90}
91
92fn display_progress_bars() {
93 println!("Progress Bars:");
94
95 let progress_levels = vec![
96 ("Download", 25, Color::BLUE),
97 ("Install", 75, Color::GREEN),
98 ("Configure", 100, Color::CYAN),
99 ("Error", 33, Color::RED),
100 ];
101
102 for (task, progress, color) in progress_levels {
103 let filled = progress / 5;
104 let empty = 20 - filled;
105
106 let bar_filled = "█".repeat(filled).color(color);
107 let bar_empty = "░".repeat(empty).color(Color::DARK_GRAY);
108
109 println!(
110 " {:<12} [{}{}] {}%",
111 task.color(Color::WHITE),
112 bar_filled,
113 bar_empty,
114 progress.to_string().color(color)
115 );
116 }
117}
118
119fn display_status_indicators() {
120 println!("\nStatus Indicators:");
121
122 let statuses = vec![
123 ("System Online", "●", Color::GREEN),
124 ("Database Connected", "●", Color::GREEN),
125 ("Cache Warning", "●", Color::YELLOW),
126 ("API Timeout", "●", Color::RED),
127 ("Maintenance Mode", "●", Color::ORANGE),
128 ("Backup Running", "◐", Color::BLUE),
129 ];
130
131 for (status, icon, color) in statuses {
132 println!(" {} {}", icon.color(color), status.color(Color::WHITE));
133 }
134
135 // Blinking critical alert
136 println!(
137 " {} {}",
138 "●".color(Color::RED),
139 "CRITICAL ALERT".color(Color::RED).bold()
140 );
141}
142
143fn display_boxes() {
144 println!("\nDecorative Boxes:");
145
146 // Simple box
147 let _box_chars = "┌─┐│└─┘";
148 println!(" {}", "┌─────────────────┐".color(Color::CYAN));
149 println!(
150 " {} {} {}",
151 "│".color(Color::CYAN),
152 " Simple Box ".color(Color::WHITE),
153 "│".color(Color::CYAN)
154 );
155 println!(" {}", "└─────────────────┘".color(Color::CYAN));
156
157 // Gradient box
158 println!(
159 "\n {}",
160 "╔═════════════════╗".gradient(Color::BLUE, Color::PURPLE, None)
161 );
162 println!(
163 " {} {} {}",
164 "║".color(Color::PURPLE),
165 " Gradient Box ".color(Color::WHITE),
166 "║".color(Color::PURPLE)
167 );
168 println!(
169 " {}",
170 "╚═════════════════╝".gradient(Color::PURPLE, Color::BLUE, None)
171 );
172
173 // Shimmering box
174 let shimmer_box = "╭─────────────────╮".shimmer(Color::GOLD, None);
175 println!("\n {}", shimmer_box.static_render());
176 println!(
177 " {} {} {}",
178 "│".color(Color::GOLD),
179 " Shimmer Box ".color(Color::WHITE),
180 "│".color(Color::GOLD)
181 );
182 println!(
183 " {}",
184 "╰─────────────────╯"
185 .shimmer(Color::GOLD, None)
186 .static_render()
187 );
188}
189
190fn display_fire_effect() {
191 println!("\nFire Effect:");
192
193 let flames = vec![
194 " ░░░",
195 " ░░▒▒░",
196 " ░▒▒▓▓▒░",
197 " ░▒▓▓██▓▒░",
198 " ░▒▓██████▓▒░",
199 " ░▒▓████████▓▒░",
200 " ░▒▓▓██████████▓▒░",
201 " ░▒▓▓████████████▓▓▒░",
202 " ░▒▓▓██████████████▓▓▒░",
203 " ░▒▓▓████████████████▓▓▒░░",
204 ];
205
206 for (i, flame) in flames.iter().enumerate() {
207 let intensity = (flames.len() - i) as f32 / flames.len() as f32;
208 let red_component = (255.0 * intensity) as u8;
209 let yellow_component = (255.0 * intensity * 0.8) as u8;
210
211 let fire_color = Color::new(red_component, yellow_component, 0);
212 println!(" {}", flame.color(fire_color));
213 }
214}
215
216fn display_matrix_effect() {
217 println!("\nMatrix Effect:");
218
219 let _matrix_chars = "01010011 01101001 01110010";
220 let lines = vec![
221 "01001000 01100101 01101100 01101100 01101111",
222 "01010111 01101111 01110010 01101100 01100100",
223 "01010100 01101001 01101110 01110100 01100101",
224 "01110010 01101101 00100000 01001101 01100001",
225 "01110100 01110010 01101001 01111000 00100001",
226 ];
227
228 for line in lines {
229 println!(" {}", line.color(Color::GREEN));
230 }
231
232 // Glowing matrix code
233 println!(
234 "\n {}",
235 "Wake up, Neo...".glow(Color::GREEN, 200).static_render()
236 );
237 println!(" {}", "The Matrix has you...".color(Color::GREEN).bold());
238 println!(
239 " {}",
240 "Follow the white rabbit."
241 .shimmer(Color::WHITE, Some(Color::BLACK))
242 .static_render()
243 );
244
245 println!(
246 "\n{}",
247 "🎭 Art showcase complete! 🎭".gradient(Color::PURPLE, Color::CYAN, None)
248 );
249}examples/shimmer_showcase.rs (line 11)
5fn main() {
6 println!("🌟 Tinterm Shimmer Showcase 🌟\n");
7
8 // Basic shimmer effect
9 println!("1. Basic Shimmer Effect:");
10 let shimmer = "✨ Shimmering Text ✨".shimmer(Color::GOLD, None);
11 println!(" Static: {}", shimmer.static_render());
12 print!(" Animated: ");
13 shimmer.animate(3);
14 println!();
15
16 // Shine effect with different colors
17 println!("2. Shine Effect:");
18 let shine_red = "🔥 Blazing Fire 🔥".shine(Color::RED);
19 let shine_blue = "💎 Crystal Blue 💎".shine(Color::CYAN);
20 let shine_green = "🌿 Forest Green 🌿".shine(Color::GREEN);
21
22 println!(" Static renders:");
23 println!(" {}", shine_red.static_render());
24 println!(" {}", shine_blue.static_render());
25 println!(" {}", shine_green.static_render());
26
27 print!(" Animated shine: ");
28 shine_red.animate(2);
29 println!();
30
31 // Glow effect with different intensities
32 println!("3. Glow Effect:");
33 let glow_soft = "🌙 Soft Moonlight 🌙".glow(Color::LIGHT_BLUE, 150);
34 let glow_medium = "⭐ Bright Star ⭐".glow(Color::YELLOW, 200);
35 let glow_intense = "☀️ Blazing Sun ☀️".glow(Color::ORANGE, 255);
36
37 println!(" Static renders:");
38 println!(" {}", glow_soft.static_render());
39 println!(" {}", glow_medium.static_render());
40 println!(" {}", glow_intense.static_render());
41
42 // Shimmer with background colors
43 println!("4. Shimmer with Background:");
44 let bg_shimmer = "🎨 Art on Canvas 🎨"
45 .shimmer(Color::WHITE, Some(Color::DARK_BLUE))
46 .speed(80);
47 print!(" ");
48 bg_shimmer.animate(3);
49 println!();
50
51 // Gradient shimmer
52 println!("5. Gradient Shimmer:");
53 let gradient_shimmer = "🌈 Rainbow Bridge 🌈"
54 .shimmer_gradient(Color::RED, Color::VIOLET, None)
55 .speed(120);
56 print!(" ");
57 gradient_shimmer.animate(3);
58 println!();
59
60 // Custom speed demonstration
61 println!("6. Speed Variations:");
62 let fast = "⚡ Lightning Fast ⚡"
63 .shimmer(Color::YELLOW, None)
64 .speed(50);
65 let slow = "🐌 Slow and Steady 🐌"
66 .shimmer(Color::GREEN, None)
67 .speed(200);
68
69 print!(" Fast: ");
70 fast.animate(2);
71 print!(" Slow: ");
72 slow.animate(2);
73 println!();
74
75 // Combining with other text effects
76 println!("7. Combined Effects:");
77 let bold_shimmer = "💪 Bold Shimmer 💪".bold().shimmer(Color::RED, None);
78 let italic_glow = "💫 Italic Glow 💫".italic().glow(Color::PURPLE, 180);
79
80 println!(" {}", bold_shimmer.static_render());
81 println!(" {}", italic_glow.static_render());
82
83 // Multi-line shimmer
84 println!("8. Multi-line Effects:");
85 let multiline = "🚀 Launch Sequence\n⭐ Stars Aligning\n🌙 Mission Success";
86 let multiline_shimmer = multiline.shimmer(Color::CYAN, Some(Color::DARK_BLUE));
87 print!(" ");
88 multiline_shimmer.animate(2);
89 println!();
90
91 // Performance showcase
92 println!("9. Performance Showcase - Multiple Effects:");
93 let effects = vec![
94 "🎯 Target Acquired".shimmer(Color::RED, None),
95 "🔍 Scanning...".shine(Color::GREEN),
96 "📡 Signal Strong".glow(Color::BLUE, 200),
97 "✅ Mission Complete".shimmer_gradient(Color::GREEN, Color::LIME, None),
98 ];
99
100 for (i, effect) in effects.iter().enumerate() {
101 print!(" Effect {}: ", i + 1);
102 effect.clone().speed(60).animate(1);
103 thread::sleep(Duration::from_millis(200));
104 }
105
106 println!("\n🎉 Shimmer showcase complete! 🎉");
107}examples/comprehensive_demo.rs (line 96)
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}Trait Implementations§
Source§impl Clone for ShimmerText
impl Clone for ShimmerText
Source§fn clone(&self) -> ShimmerText
fn clone(&self) -> ShimmerText
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ShimmerText
impl RefUnwindSafe for ShimmerText
impl Send for ShimmerText
impl Sync for ShimmerText
impl Unpin for ShimmerText
impl UnwindSafe for ShimmerText
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more