Struct terminal_light::Rgb
source · [−]Expand description
RGB color, with u8 components
Fields
r: u8
red
g: u8
green
b: u8
blue
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: Rgb, w1: f32, c2: Rgb, w2: f32) -> Rgb
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>(self, other: H) -> f32 where
H: Into<Hsl>,
pub fn distance_to<H>(self, other: H) -> f32 where
H: Into<Hsl>,
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more