use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Color32([u8; 4]);
impl Color32 {
pub const BLACK: Self = Self([0, 0, 0, 255]);
pub const GRAY: Self = Self([128, 128, 128, 255]);
pub const TRANSPARENT: Self = Self([0, 0, 0, 0]);
pub const WHITE: Self = Self([255, 255, 255, 255]);
pub const fn from_rgb(r: u8, g: u8, b: u8) -> Self {
Self([r, g, b, 255])
}
pub const fn from_rgba_unmultiplied(r: u8, g: u8, b: u8, a: u8) -> Self {
Self([r, g, b, a])
}
pub const fn from_gray(value: u8) -> Self {
Self([value, value, value, 255])
}
pub const fn r(self) -> u8 {
self.0[0]
}
pub const fn g(self) -> u8 {
self.0[1]
}
pub const fn b(self) -> u8 {
self.0[2]
}
pub const fn a(self) -> u8 {
self.0[3]
}
pub const fn to_array(self) -> [u8; 4] {
self.0
}
}