mirror of
https://github.com/catppuccin/rust.git
synced 2026-02-23 00:04:11 +08:00
Co-authored-by: backwardspy <backwardspy@pigeon.life> Co-authored-by: sgoudham <sgoudham@gmail.com>
27 lines
901 B
Rust
27 lines
901 B
Rust
//! Example demonstrating integration with the `css-colors` crate.
|
|
use css_colors::{percent, Color};
|
|
|
|
fn main() {
|
|
let teal = catppuccin::PALETTE.mocha.colors.teal;
|
|
let rgb: css_colors::RGB = teal.into();
|
|
|
|
println!("RGB: {}", rgb.to_css());
|
|
|
|
let hsl = rgb.to_hsl();
|
|
println!("HSL: {}", hsl.to_css());
|
|
|
|
let lighter = hsl.lighten(percent(20));
|
|
println!("20% lighter: {lighter}");
|
|
|
|
let ansi_normal_magenta = catppuccin::PALETTE.mocha.ansi_colors.magenta;
|
|
let ansi_bright_magenta = catppuccin::PALETTE.mocha.ansi_colors.bright_magenta;
|
|
let ansi_magenta_normal_rgb: css_colors::RGB = ansi_normal_magenta.into();
|
|
let ansi_magenta_bright_rgb: css_colors::RGB = ansi_bright_magenta.into();
|
|
|
|
println!("ANSI Magenta RGB: {}", ansi_magenta_normal_rgb.to_css());
|
|
println!(
|
|
"ANSI Bright Magenta RGB: {}",
|
|
ansi_magenta_bright_rgb.to_css()
|
|
);
|
|
}
|