Expand description
RGB color, with u8 components
Fields
r: u8red
g: u8green
b: u8blue
Implementations
sourceimpl Rgb
impl Rgb
pub const fn is_grey(self) -> bool
sourcepub fn to_ansi(self) -> AnsiColor
pub fn to_ansi(self) -> AnsiColor
Return the nearest ANSI color
This is a slow function as it literally tries all ANSI colors and picks the nearest one.
pub fn mix(c1: Self, w1: f32, c2: Self, w2: f32) -> Self
pub fn to_hsl(self) -> Hsl
pub fn parts(self) -> (f32, f32, f32)
sourcepub fn luma(self) -> f32
pub fn luma(self) -> f32
Compute the Luma value characterizing the “light” of the color, going from 0 (black) to 1 (white).
Reference: https://en.wikipedia.org/wiki/Luma_(video)
sourcepub fn distance_to<H: Into<Hsl>>(self, other: H) -> f32
pub fn distance_to<H: Into<Hsl>>(self, other: H) -> f32
tentatively perceptual distance between the two colors, based on a conversion to HSL
Trait Implementations
impl Copy for Rgb
impl Eq for Rgb
impl StructuralEq for Rgb
impl StructuralPartialEq for Rgb
Auto Trait Implementations
impl RefUnwindSafe for Rgb
impl Send for Rgb
impl Sync for Rgb
impl Unpin for Rgb
impl UnwindSafe for Rgb
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more