graphics_style/styles/color/
mod.rs1use super::*;
2use palette::{Srgb, Srgba};
3use std::marker::PhantomData;
4mod builtin;
5mod convert;
6mod display;
7mod serder;
8
9#[derive(Debug, Copy, Clone, PartialEq, Eq)]
11pub struct Color(Srgba<u8>);
12
13impl Color {
14 pub const fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self {
16 Self(Srgba { color: Srgb { red, green, blue, standard: PhantomData }, alpha })
17 }
18 #[inline(always)]
20 pub const fn view(&self) -> (u8, u8, u8, u8) {
21 (self.0.color.red, self.0.color.green, self.0.color.blue, self.0.alpha)
22 }
23}