Expand description
HSL color
Fields
h: f32
hue in [0,360[
s: f32
saturation in [0,1]
l: f32
luminosity in [0,1]
Implementations
sourceimpl Hsl
impl Hsl
sourcepub fn checked(h: f32, s: f32, l: f32) -> Result<Self, CoolorError>
pub fn checked(h: f32, s: f32, l: f32) -> Result<Self, CoolorError>
Create a new HSL color from its components, checking the ranges
pub fn mix(c1: Self, w1: f32, c2: Self, w2: f32) -> Self
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 to_rgb(self) -> Rgb
pub fn delta_h(self, other: Hsl) -> f32
pub fn delta_s(self, other: Hsl) -> f32
pub fn delta_l(self, other: Hsl) -> f32
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, except it’s just as unscientific it can possibly be so check it looks good before trying ot use it, at least…
Trait Implementations
impl Copy for Hsl
impl StructuralPartialEq for Hsl
Auto Trait Implementations
impl RefUnwindSafe for Hsl
impl Send for Hsl
impl Sync for Hsl
impl Unpin for Hsl
impl UnwindSafe for Hsl
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