use colored::Colorize;
use prismatica::matplotlib::VIRIDIS;
fn main() {
println!(
"Colormap: {} ({})\n",
VIRIDIS.meta.name, VIRIDIS.meta.collection
);
println!("Colored words:");
let words: Vec<&str> =
"Prismatica provides 308 scientific colormaps as compile-time Rust constants"
.split_whitespace()
.collect();
print!(" ");
for (i, word) in words.iter().enumerate() {
let t = i as f32 / (words.len() - 1) as f32;
let color: colored::Color = VIRIDIS.eval(t).into();
print!("{} ", word.color(color));
}
println!();
println!("\nBold text with colored backgrounds:");
for i in 0..8 {
let t = i as f32 / 7.0;
let color: colored::Color = VIRIDIS.eval(t).into();
let label = format!(" t = {t:.2} ");
println!(" {}", label.bold().on_color(color));
}
println!("\nPer-character gradient:");
let text = "Scientific visualization with prismatica colormaps";
print!(" ");
for (i, ch) in text.chars().enumerate() {
let t = i as f32 / (text.len() - 1) as f32;
let color: colored::Color = VIRIDIS.eval(t).into();
print!("{}", ch.to_string().color(color).bold());
}
println!();
println!("\nGradient blocks:");
print!(" ");
for i in 0..32 {
let t = i as f32 / 31.0;
let color: colored::Color = VIRIDIS.eval(t).into();
print!("{}", " ".on_color(color));
}
println!();
}