Expand description
HSL color
Fields§
§h: f32hue in [0,360[
s: f32saturation in [0,1]
l: f32luminosity in [0,1]
Implementations§
source§impl 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…