pub struct Rgb {
pub r: u8,
pub g: u8,
pub b: u8,
}Expand description
An sRGB color. Hex round-trips losslessly.
Fields§
§r: u8§g: u8§b: u8Implementations§
Source§impl Rgb
impl Rgb
Sourcepub fn to_oklab(self) -> Oklab
pub fn to_oklab(self) -> Oklab
Convert to OKLab (Ottosson’s sRGB matrices).
The matrix coefficients are quoted at their published precision so they
can be diffed against the reference. f32 rounds them at compile time;
truncating the literals would only make them harder to check.
Sourcepub fn from_oklab(c: Oklab) -> Rgb
pub fn from_oklab(c: Oklab) -> Rgb
Convert from OKLab back to the nearest in-gamut sRGB.
Published precision, as in Rgb::to_oklab.
Trait Implementations§
impl Copy for Rgb
impl Eq for Rgb
impl StructuralPartialEq for Rgb
Auto Trait Implementations§
impl Freeze for Rgb
impl RefUnwindSafe for Rgb
impl Send for Rgb
impl Sync for Rgb
impl Unpin for Rgb
impl UnsafeUnpin for Rgb
impl UnwindSafe for Rgb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more