#[repr(C)]pub struct Hsl<S = Srgb, T = f32> where
T: FloatComponent,
S: RgbStandard, {
pub hue: RgbHue<T>,
pub saturation: T,
pub lightness: T,
pub standard: PhantomData<S>,
}
Expand description
HSL color space.
The HSL color space can be seen as a cylindrical version of
RGB, where the hue
is the angle around the color
cylinder, the saturation
is the distance from the center, and the
lightness
is the height from the bottom. Its composition makes it
especially good for operations like changing green to red, making a color
more gray, or making it darker.
See HSV for a very similar color space, with brightness instead of lightness.
Fields
hue: RgbHue<T>
The hue of the color, in degrees. Decides if it’s red, blue, purple, etc.
saturation: T
The colorfulness of the color. 0.0 gives gray scale colors and 1.0 will give absolutely clear colors.
lightness: T
Decides how light the color will look. 0.0 will be black, 0.5 will give a clear color, and 1.0 will give white.
standard: PhantomData<S>
The white point and RGB primaries this color is adapted to. The default is the sRGB standard.
Implementations
sourceimpl<T> Hsl<Srgb, T> where
T: FloatComponent,
impl<T> Hsl<Srgb, T> where
T: FloatComponent,
sourceimpl<S, T> Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourcepub fn with_wp<H: Into<RgbHue<T>>>(
hue: H,
saturation: T,
lightness: T
) -> Hsl<S, T>
pub fn with_wp<H: Into<RgbHue<T>>>(
hue: H,
saturation: T,
lightness: T
) -> Hsl<S, T>
Linear HSL.
sourcepub fn into_components(self) -> (RgbHue<T>, T, T)
pub fn into_components(self) -> (RgbHue<T>, T, T)
Convert to a (hue, saturation, lightness)
tuple.
sourcepub fn from_components<H: Into<RgbHue<T>>>(
(hue, saturation, lightness): (H, T, T)
) -> Self
pub fn from_components<H: Into<RgbHue<T>>>(
(hue, saturation, lightness): (H, T, T)
) -> Self
Convert from a (hue, saturation, lightness)
tuple.
sourcepub fn min_saturation() -> T
pub fn min_saturation() -> T
Return the saturation
value minimum.
sourcepub fn max_saturation() -> T
pub fn max_saturation() -> T
Return the saturation
value maximum.
sourcepub fn min_lightness() -> T
pub fn min_lightness() -> T
Return the lightness
value minimum.
sourcepub fn max_lightness() -> T
pub fn max_lightness() -> T
Return the lightness
value maximum.
Trait Implementations
sourceimpl<S, T> AbsDiffEq<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + AbsDiffEq,
T::Epsilon: Copy + Float + FromF64,
S: RgbStandard + PartialEq,
impl<S, T> AbsDiffEq<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + AbsDiffEq,
T::Epsilon: Copy + Float + FromF64,
S: RgbStandard + PartialEq,
sourcefn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
sourcefn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
sourcefn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of AbsDiffEq::abs_diff_eq
.
sourceimpl<S, T> Add<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Add<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S, T> Add<T> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Add<T> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S, T> AddAssign<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + AddAssign,
S: RgbStandard,
impl<S, T> AddAssign<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + AddAssign,
S: RgbStandard,
sourcefn add_assign(&mut self, other: Hsl<S, T>)
fn add_assign(&mut self, other: Hsl<S, T>)
Performs the +=
operation. Read more
sourceimpl<S, T> AddAssign<T> for Hsl<S, T> where
T: FloatComponent + AddAssign,
S: RgbStandard,
impl<S, T> AddAssign<T> for Hsl<S, T> where
T: FloatComponent + AddAssign,
S: RgbStandard,
sourcefn add_assign(&mut self, c: T)
fn add_assign(&mut self, c: T)
Performs the +=
operation. Read more
sourceimpl<S, T, P> AsMut<P> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
P: RawPixel<T> + ?Sized,
impl<S, T, P> AsMut<P> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
P: RawPixel<T> + ?Sized,
sourceimpl<S, T, P> AsRef<P> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
P: RawPixel<T> + ?Sized,
impl<S, T, P> AsRef<P> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
P: RawPixel<T> + ?Sized,
sourceimpl<S, T> Clamp for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Clamp for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourcefn is_within_bounds(&self) -> bool
fn is_within_bounds(&self) -> bool
Check if the color’s components are within the expected clamped range bounds. Read more
sourcefn clamp(&self) -> Hsl<S, T>
fn clamp(&self) -> Hsl<S, T>
Return a new color where the components have been clamped to the nearest valid values. Read more
sourcefn clamp_self(&mut self)
fn clamp_self(&mut self)
Clamp the color’s components to the nearest valid values.
sourceimpl<S, T> Clone for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Clone for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S: Debug, T: Debug> Debug for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S: Debug, T: Debug> Debug for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S, T> Default for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Default for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S: RgbStandard, T: FloatComponent, H: Into<RgbHue<T>>> From<(H, T, T)> for Hsl<S, T>
impl<S: RgbStandard, T: FloatComponent, H: Into<RgbHue<T>>> From<(H, T, T)> for Hsl<S, T>
sourceimpl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<S, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Hsl<S, T>> for Hsv<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> FromColorUnclamped<Hsl<S, T>> for Hsv<S, T> where
T: FloatComponent,
S: RgbStandard,
sourcefn from_color_unclamped(hsl: Hsl<S, T>) -> Self
fn from_color_unclamped(hsl: Hsl<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Hsl<S, T>> for Hwb<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Hsl<S, T>> for Hwb<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(color: Hsl<S, T>) -> Self
fn from_color_unclamped(color: Hsl<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Hsl<S, T>> for Rgb<S, T> where
S: RgbStandard,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Hsl<S, T>> for Rgb<S, T> where
S: RgbStandard,
T: FloatComponent,
sourcefn from_color_unclamped(hsl: Hsl<S, T>) -> Self
fn from_color_unclamped(hsl: Hsl<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S1, S2, T> FromColorUnclamped<Hsl<S1, T>> for Hsl<S2, T> where
T: FloatComponent,
S1: RgbStandard,
S2: RgbStandard,
S1::Space: RgbSpace<WhitePoint = <S2::Space as RgbSpace>::WhitePoint>,
impl<S1, S2, T> FromColorUnclamped<Hsl<S1, T>> for Hsl<S2, T> where
T: FloatComponent,
S1: RgbStandard,
S2: RgbStandard,
S1::Space: RgbSpace<WhitePoint = <S2::Space as RgbSpace>::WhitePoint>,
sourcefn from_color_unclamped(hsl: Hsl<S1, T>) -> Self
fn from_color_unclamped(hsl: Hsl<S1, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Hsluv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Hsluv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Lab<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Lab<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Lch<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Lch<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Lchuv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Lchuv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _S> FromColorUnclamped<Hsl<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> FromColorUnclamped<Hsl<_S, T>> for Luma<S, T> where
T: Component,
S: LumaStandard,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Luv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Luv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T, _S> FromColorUnclamped<Hsl<_S, T>> for Oklab<T> where
T: FloatComponent,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = D65>,
impl<T, _S> FromColorUnclamped<Hsl<_S, T>> for Oklab<T> where
T: FloatComponent,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = D65>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T, _S> FromColorUnclamped<Hsl<_S, T>> for Oklch<T> where
T: FloatComponent,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = D65>,
impl<T, _S> FromColorUnclamped<Hsl<_S, T>> for Oklch<T> where
T: FloatComponent,
T: FloatComponent,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = D65>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Yxy<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Yxy<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Hsluv<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Hsluv<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Hsluv<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Hsluv<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Hsv<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> FromColorUnclamped<Hsv<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourcefn from_color_unclamped(hsv: Hsv<S, T>) -> Self
fn from_color_unclamped(hsv: Hsv<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Hwb<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Hwb<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(color: Hwb<S, T>) -> Self
fn from_color_unclamped(color: Hwb<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Lab<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Lab<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Lab<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Lab<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Lch<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Lch<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Lch<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Lch<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Lchuv<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Lchuv<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Lchuv<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Lchuv<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T, _S> FromColorUnclamped<Luma<_S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
impl<S, T, _S> FromColorUnclamped<Luma<_S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
_S: LumaStandard<WhitePoint = <S::Space as RgbSpace>::WhitePoint>,
sourcefn from_color_unclamped(color: Luma<_S, T>) -> Self
fn from_color_unclamped(color: Luma<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Luv<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Luv<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Luv<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Luv<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Oklab<T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
Rgb<S, T>: FromColorUnclamped<Oklab<T>>,
impl<S, T> FromColorUnclamped<Oklab<T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
Rgb<S, T>: FromColorUnclamped<Oklab<T>>,
sourcefn from_color_unclamped(color: Oklab<T>) -> Self
fn from_color_unclamped(color: Oklab<T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Oklch<T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
Rgb<S, T>: FromColorUnclamped<Oklch<T>>,
impl<S, T> FromColorUnclamped<Oklch<T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
Rgb<S, T>: FromColorUnclamped<Oklch<T>>,
sourcefn from_color_unclamped(color: Oklch<T>) -> Self
fn from_color_unclamped(color: Oklch<T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Rgb<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> FromColorUnclamped<Rgb<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourcefn from_color_unclamped(rgb: Rgb<S, T>) -> Self
fn from_color_unclamped(rgb: Rgb<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Yxy<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Yxy<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Yxy<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Yxy<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> GetHue for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> GetHue for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S, T> Hue for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Hue for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S: RgbStandard, T: FloatComponent> Into<(RgbHue<T>, T, T)> for Hsl<S, T>
impl<S: RgbStandard, T: FloatComponent> Into<(RgbHue<T>, T, T)> for Hsl<S, T>
sourceimpl<S, T> Mix for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Mix for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S, T> PartialEq<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + PartialEq,
S: RgbStandard,
impl<S, T> PartialEq<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + PartialEq,
S: RgbStandard,
sourceimpl<S, T> Pixel<T> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Pixel<T> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourcefn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
fn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
Cast as a mutable reference to raw color components.
sourcefn into_raw<P: RawPixelSized<T>>(self) -> P
fn into_raw<P: RawPixelSized<T>>(self) -> P
Convert into raw color components.
sourcefn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
fn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
Cast from a reference to raw color components.
sourcefn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
fn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
Cast from a mutable reference to raw color components.
sourcefn from_raw_slice(slice: &[T]) -> &[Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn from_raw_slice(slice: &[T]) -> &[Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Cast a slice of raw color components to a slice of colors. Read more
sourcefn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Cast a mutable slice of raw color components to a mutable slice of colors. Read more
sourceimpl<S, T> RelativeContrast for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> RelativeContrast for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
type Scalar = T
type Scalar = T
The type of the contrast ratio.
sourcefn get_contrast_ratio(&self, other: &Self) -> T
fn get_contrast_ratio(&self, other: &Self) -> T
Calculate the contrast ratio between two colors.
sourcefn has_min_contrast_text(&self, other: &Self) -> bool
fn has_min_contrast_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.3. Contrast is at least 4.5:1 (Level AA). Read more
sourcefn has_min_contrast_large_text(&self, other: &Self) -> bool
fn has_min_contrast_large_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.3 for large text. Contrast is at least 3:1 (Level AA). Read more
sourcefn has_enhanced_contrast_text(&self, other: &Self) -> bool
fn has_enhanced_contrast_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.6. Contrast is at least 7:1 (Level AAA). Read more
sourcefn has_enhanced_contrast_large_text(&self, other: &Self) -> bool
fn has_enhanced_contrast_large_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.6 for large text. Contrast is at least 4.5:1 (Level AAA). Read more
sourcefn has_min_contrast_graphics(&self, other: &Self) -> bool
fn has_min_contrast_graphics(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.11 for graphical objects. Contrast is at least 3:1 (Level AA). Read more
sourceimpl<S, T> RelativeEq<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + RelativeEq,
T::Epsilon: Copy + Float + FromF64,
S: RgbStandard + PartialEq,
impl<S, T> RelativeEq<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + RelativeEq,
T::Epsilon: Copy + Float + FromF64,
S: RgbStandard + PartialEq,
sourcefn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
sourcefn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
sourcefn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
The inverse of RelativeEq::relative_eq
.
sourceimpl<S, T> Saturate for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Saturate for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
type Scalar = T
type Scalar = T
The type of the (de)saturation modifier.
sourcefn saturate(&self, factor: T) -> Hsl<S, T>
fn saturate(&self, factor: T) -> Hsl<S, T>
Scale the color towards the maximum saturation by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn saturate_fixed(&self, amount: T) -> Hsl<S, T>
fn saturate_fixed(&self, amount: T) -> Hsl<S, T>
Increase the saturation by amount
, a value ranging from 0.0
to
1.0
. Read more
sourcefn desaturate(&self, factor: Self::Scalar) -> Self
fn desaturate(&self, factor: Self::Scalar) -> Self
Scale the color towards the minimum saturation by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn desaturate_fixed(&self, amount: Self::Scalar) -> Self
fn desaturate_fixed(&self, amount: Self::Scalar) -> Self
Increase the saturation by amount
, a value ranging from 0.0
to
1.0
. Read more
sourceimpl<S, T> Shade for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Shade for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
type Scalar = T
type Scalar = T
The type of the lighten/darken modifier.
sourcefn lighten(&self, factor: T) -> Hsl<S, T>
fn lighten(&self, factor: T) -> Hsl<S, T>
Scale the color towards the maximum lightness by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn lighten_fixed(&self, amount: T) -> Hsl<S, T>
fn lighten_fixed(&self, amount: T) -> Hsl<S, T>
Lighten the color by amount
, a value ranging from 0.0
to 1.0
. Read more
sourcefn darken(&self, factor: Self::Scalar) -> Self
fn darken(&self, factor: Self::Scalar) -> Self
Scale the color towards the minimum lightness by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn darken_fixed(&self, amount: Self::Scalar) -> Self
fn darken_fixed(&self, amount: Self::Scalar) -> Self
Darken the color by amount
, a value ranging from 0.0
to 1.0
. Read more
sourceimpl<S, T> Sub<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Sub<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S, T> Sub<T> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Sub<T> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
sourceimpl<S, T> SubAssign<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + SubAssign,
S: RgbStandard,
impl<S, T> SubAssign<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + SubAssign,
S: RgbStandard,
sourcefn sub_assign(&mut self, other: Hsl<S, T>)
fn sub_assign(&mut self, other: Hsl<S, T>)
Performs the -=
operation. Read more
sourceimpl<S, T> SubAssign<T> for Hsl<S, T> where
T: FloatComponent + SubAssign,
S: RgbStandard,
impl<S, T> SubAssign<T> for Hsl<S, T> where
T: FloatComponent + SubAssign,
S: RgbStandard,
sourcefn sub_assign(&mut self, c: T)
fn sub_assign(&mut self, c: T)
Performs the -=
operation. Read more
sourceimpl<S, T> UlpsEq<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + UlpsEq,
T::Epsilon: Copy + Float + FromF64,
S: RgbStandard + PartialEq,
impl<S, T> UlpsEq<Hsl<S, T>> for Hsl<S, T> where
T: FloatComponent + UlpsEq,
T::Epsilon: Copy + Float + FromF64,
S: RgbStandard + PartialEq,
sourceimpl<S, T, _A> WithAlpha<_A> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
_A: Component,
impl<S, T, _A> WithAlpha<_A> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
_A: Component,
sourcefn with_alpha(self, alpha: _A) -> Self::WithAlpha
fn with_alpha(self, alpha: _A) -> Self::WithAlpha
Transforms the color into a transparent color with the provided
alpha value. If Self
already has a transparency, it is
overwritten. Read more
sourcefn without_alpha(self) -> Self::Color
fn without_alpha(self) -> Self::Color
Removes the transparency from the color. If Self::Color
has
an internal transparency field, that field will be set to
A::max_intensity()
to make it opaque. Read more
sourcefn split(self) -> (Self::Color, _A)
fn split(self) -> (Self::Color, _A)
Splits the color into separate color and transparency values. Read more
sourcefn opaque(self) -> Self::WithAlpha
fn opaque(self) -> Self::WithAlpha
Transforms the color into a fully opaque color with a transparency
field. If Self
already has a transparency, it is overwritten. Read more
sourcefn transparent(self) -> Self::WithAlpha
fn transparent(self) -> Self::WithAlpha
Transforms the color into a fully transparent color. If Self
already has a transparency, it is overwritten. Read more
impl<S, T> Copy for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
impl<S, T> Eq for Hsl<S, T> where
T: FloatComponent + Eq,
S: RgbStandard,
Auto Trait Implementations
impl<S, T> RefUnwindSafe for Hsl<S, T> where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<S, T> Send for Hsl<S, T> where
S: Send,
T: Send,
impl<S, T> Sync for Hsl<S, T> where
S: Sync,
T: Sync,
impl<S, T> Unpin for Hsl<S, T> where
S: Unpin,
T: Unpin,
impl<S, T> UnwindSafe for Hsl<S, T> where
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColorUnclamped<Xyz<Swp, T>>,
D: FromColorUnclamped<Xyz<Dwp, T>>,
impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColorUnclamped<Xyz<Swp, T>>,
D: FromColorUnclamped<Xyz<Dwp, T>>,
sourcefn adapt_from_using<M>(color: S, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_from_using<M>(color: S, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_from(color: S) -> Self
fn adapt_from(color: S) -> Self
Convert the source color to the destination color using the bradford method by default Read more
sourceimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
sourcefn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford method by default Read more
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, U> FromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
impl<T, U> FromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
sourcefn from_color(t: T) -> U
fn from_color(t: T) -> U
Convert from T with values clamped to the color defined bounds. Read more
sourceimpl<T, U> IntoColor<U> for T where
U: FromColor<T>,
impl<T, U> IntoColor<U> for T where
U: FromColor<T>,
sourcefn into_color(self) -> U
fn into_color(self) -> U
Convert into T with values clamped to the color defined bounds Read more
sourceimpl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
sourcefn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
sourceimpl<T, U> TryFromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
impl<T, U> TryFromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
sourcefn try_from_color(t: T) -> Result<U, OutOfBounds<U>>
fn try_from_color(t: T) -> Result<U, OutOfBounds<U>>
Convert from T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more
sourceimpl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
sourcefn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more