Skip to main content

impulse_thaw/color_picker/
color.rs

1use palette::{Hsl, Hsv, Srgb};
2
3#[derive(Clone)]
4pub enum Color {
5    RGB(Srgb),
6    HSV(Hsv),
7    HSL(Hsl),
8}
9
10impl Default for Color {
11    fn default() -> Self {
12        Self::RGB(Srgb::new(0.0, 0.0, 0.0))
13    }
14}
15
16impl From<Srgb> for Color {
17    fn from(value: Srgb) -> Self {
18        Self::RGB(value)
19    }
20}
21
22impl From<Hsv> for Color {
23    fn from(value: Hsv) -> Self {
24        Self::HSV(value)
25    }
26}
27
28impl From<Hsl> for Color {
29    fn from(value: Hsl) -> Self {
30        Self::HSL(value)
31    }
32}