#[derive(Clone, Copy, Debug)]
pub struct Color {
pub r: f64,
pub g: f64,
pub b: f64,
pub a: f64,
}
impl Color {
pub const fn new(r: f64, g: f64, b: f64, a: f64) -> Self {
Self { r, g, b, a }
}
pub const fn rgb(r: f64, g: f64, b: f64) -> Self {
Self { r, g, b, a: 1.0 }
}
pub fn hex(hex: u32) -> Self {
Self {
r: ((hex >> 16) & 0xFF) as f64 / 255.0,
g: ((hex >> 8) & 0xFF) as f64 / 255.0,
b: (hex & 0xFF) as f64 / 255.0,
a: 1.0,
}
}
pub const RED: Self = Self::new(1.0, 0.0, 0.0, 1.0);
pub const GREEN: Self = Self::new(0.0, 1.0, 0.0, 1.0);
pub const BLUE: Self = Self::new(0.0, 0.0, 1.0, 1.0);
pub const WHITE: Self = Self::new(1.0, 1.0, 1.0, 1.0);
pub const BLACK: Self = Self::new(0.0, 0.0, 0.0, 1.0);
pub const CLEAR: Self = Self::new(0.0, 0.0, 0.0, 0.0);
pub const GRAY: Self = Self::new(0.5, 0.5, 0.5, 1.0);
pub const YELLOW: Self = Self::new(1.0, 1.0, 0.0, 1.0);
pub const PURPLE: Self = Self::new(0.5, 0.0, 0.5, 1.0);
pub const DARK: Self = Self::new(0.15, 0.15, 0.15, 1.0);
}