Files
Polymusic/src/utils.rs
2025-07-05 20:28:00 +02:00

13 lines
384 B
Rust

use iced::Color;
pub fn string_to_color<S: AsRef<str>>(s: S) -> Color {
match s.as_ref() {
"Green" => Color::from_rgb(0.0, 1.0, 0.0),
"Blue" => Color::from_rgb(0.0, 0.0, 1.0),
"Cyan" => Color::from_rgb(0.0, 1.0, 1.0),
"Yellow" => Color::from_rgb(1.0, 1.0, 0.0),
"Pink" => Color::from_rgb(1.0, 0.0, 1.0),
_ => Color::BLACK,
}
}