#[repr(C)]pub struct Hsl<S = Srgb, T = f32>{
pub hue: RgbHue<T>,
pub saturation: T,
pub lightness: T,
pub space: PhantomData<S>,
}
Expand description
Linear 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.
space: PhantomData<S>
The white point and RGB primaries this color is adapted to. The default is the sRGB standard.
Implementations§
source§impl<S, T> Hsl<S, T>
impl<S, T> Hsl<S, T>
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.
Trait Implementations§
source§impl<S, T> AbsDiffEq for Hsl<S, T>
impl<S, T> AbsDiffEq for Hsl<S, T>
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
source§impl<S, T> AddAssign<T> for Hsl<S, T>
impl<S, T> AddAssign<T> for Hsl<S, T>
source§fn add_assign(&mut self, c: T)
fn add_assign(&mut self, c: T)
+=
operation. Read moresource§impl<S, T> AddAssign for Hsl<S, T>
impl<S, T> AddAssign for Hsl<S, T>
source§fn add_assign(&mut self, other: Hsl<S, T>)
fn add_assign(&mut self, other: Hsl<S, T>)
+=
operation. Read moresource§impl<'de, S, T> Deserialize<'de> for Hsl<S, T>
impl<'de, S, T> Deserialize<'de> for Hsl<S, T>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<S, T, _S> From<Alpha<Luma<_S, T>, T>> for Hsl<S, T>where
T: Component + Float + Component + _FloatTrait,
S: RgbSpace,
_S: LumaStandard<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Alpha<Luma<_S, T>, T>> for Hsl<S, T>where
T: Component + Float + Component + _FloatTrait,
S: RgbSpace,
_S: LumaStandard<WhitePoint = S::WhitePoint>,
source§impl<S: RgbStandard, T> From<Hsl<<S as RgbStandard>::Space, T>> for Alpha<Rgb<S, T>, T>
impl<S: RgbStandard, T> From<Hsl<<S as RgbStandard>::Space, T>> for Alpha<Rgb<S, T>, T>
source§impl<S, T, Sp, Wp> From<Hsl<Sp, T>> for Rgb<S, T>where
S: RgbStandard,
T: Component + Float,
Wp: WhitePoint,
S::Space: RgbSpace<WhitePoint = Wp>,
Sp: RgbSpace<WhitePoint = Wp>,
impl<S, T, Sp, Wp> From<Hsl<Sp, T>> for Rgb<S, T>where
S: RgbStandard,
T: Component + Float,
Wp: WhitePoint,
S::Space: RgbSpace<WhitePoint = Wp>,
Sp: RgbSpace<WhitePoint = Wp>,
source§impl<Wp, T, _S> From<Hsl<_S, T>> for Alpha<Lab<Wp, T>, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> From<Hsl<_S, T>> for Alpha<Lab<Wp, T>, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
source§impl<Wp, T, _S> From<Hsl<_S, T>> for Alpha<Lch<Wp, T>, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> From<Hsl<_S, T>> for Alpha<Lch<Wp, T>, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
source§impl<S, T, _S> From<Hsl<_S, T>> for Alpha<Luma<S, T>, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Hsl<_S, T>> for Alpha<Luma<S, T>, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
source§impl<Wp, T, _S> From<Hsl<_S, T>> for Alpha<Xyz<Wp, T>, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> From<Hsl<_S, T>> for Alpha<Xyz<Wp, T>, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
source§impl<Wp, T, _S> From<Hsl<_S, T>> for Alpha<Yxy<Wp, T>, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> From<Hsl<_S, T>> for Alpha<Yxy<Wp, T>, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
source§impl<Wp, T, _S> From<Hsl<_S, T>> for Lab<Wp, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> From<Hsl<_S, T>> for Lab<Wp, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
source§impl<Wp, T, _S> From<Hsl<_S, T>> for Lch<Wp, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> From<Hsl<_S, T>> for Lch<Wp, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
source§impl<S, T, _S> From<Hsl<_S, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Hsl<_S, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
source§impl<Wp, T, _S> From<Hsl<_S, T>> for Xyz<Wp, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> From<Hsl<_S, T>> for Xyz<Wp, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
source§impl<Wp, T, _S> From<Hsl<_S, T>> for Yxy<Wp, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> From<Hsl<_S, T>> for Yxy<Wp, T>where
T: Component + Float + Component + _FloatTrait,
Wp: WhitePoint,
_S: RgbSpace<WhitePoint = Wp>,
source§impl<S, T> From<Lab<<S as RgbSpace>::WhitePoint, T>> for Hsl<S, T>
impl<S, T> From<Lab<<S as RgbSpace>::WhitePoint, T>> for Hsl<S, T>
source§fn from(color: Lab<S::WhitePoint, T>) -> Self
fn from(color: Lab<S::WhitePoint, T>) -> Self
source§impl<S, T> From<Lch<<S as RgbSpace>::WhitePoint, T>> for Hsl<S, T>
impl<S, T> From<Lch<<S as RgbSpace>::WhitePoint, T>> for Hsl<S, T>
source§fn from(color: Lch<S::WhitePoint, T>) -> Self
fn from(color: Lch<S::WhitePoint, T>) -> Self
source§impl<S, T, _S> From<Luma<_S, T>> for Hsl<S, T>where
T: Component + Float + Component + _FloatTrait,
S: RgbSpace,
_S: LumaStandard<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Luma<_S, T>> for Hsl<S, T>where
T: Component + Float + Component + _FloatTrait,
S: RgbSpace,
_S: LumaStandard<WhitePoint = S::WhitePoint>,
source§impl<S, T> From<Xyz<<S as RgbSpace>::WhitePoint, T>> for Hsl<S, T>
impl<S, T> From<Xyz<<S as RgbSpace>::WhitePoint, T>> for Hsl<S, T>
source§fn from(color: Xyz<S::WhitePoint, T>) -> Self
fn from(color: Xyz<S::WhitePoint, T>) -> Self
source§impl<S, T> From<Yxy<<S as RgbSpace>::WhitePoint, T>> for Hsl<S, T>
impl<S, T> From<Yxy<<S as RgbSpace>::WhitePoint, T>> for Hsl<S, T>
source§fn from(color: Yxy<S::WhitePoint, T>) -> Self
fn from(color: Yxy<S::WhitePoint, T>) -> Self
source§impl<S, T> FromColor<<S as RgbSpace>::WhitePoint, T> for Hsl<S, T>
impl<S, T> FromColor<<S as RgbSpace>::WhitePoint, T> for Hsl<S, T>
source§fn from_xyz(color: Xyz<S::WhitePoint, T>) -> Self
fn from_xyz(color: Xyz<S::WhitePoint, T>) -> Self
source§fn from_rgb<_S: RgbSpace<WhitePoint = S::WhitePoint>>(
color: Rgb<Linear<_S>, T>
) -> Self
fn from_rgb<_S: RgbSpace<WhitePoint = S::WhitePoint>>( color: Rgb<Linear<_S>, T> ) -> Self
source§fn from_hsv<_S: RgbSpace<WhitePoint = S::WhitePoint>>(color: Hsv<_S, T>) -> Self
fn from_hsv<_S: RgbSpace<WhitePoint = S::WhitePoint>>(color: Hsv<_S, T>) -> Self
source§fn from_hsl<_S: RgbSpace<WhitePoint = S::WhitePoint>>(color: Hsl<_S, T>) -> Self
fn from_hsl<_S: RgbSpace<WhitePoint = S::WhitePoint>>(color: Hsl<_S, T>) -> Self
source§impl<S, Wp, T> IntoColor<Wp, T> for Hsl<S, T>
impl<S, Wp, T> IntoColor<Wp, T> for Hsl<S, T>
source§impl<S, T> Limited for Hsl<S, T>
impl<S, T> Limited for Hsl<S, T>
source§impl<S, T> PartialEq for Hsl<S, T>
impl<S, T> PartialEq for Hsl<S, T>
source§impl<S, T> Pixel<T> for Hsl<S, T>
impl<S, T> Pixel<T> for Hsl<S, T>
source§fn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
fn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
source§fn into_raw<P: RawPixelSized<T>>(self) -> P
fn into_raw<P: RawPixelSized<T>>(self) -> P
source§fn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
fn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
source§fn 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
source§fn from_raw_slice(slice: &[T]) -> &[Self]
fn from_raw_slice(slice: &[T]) -> &[Self]
source§fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]
fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]
source§impl<S, T> RelativeEq for Hsl<S, T>
impl<S, T> RelativeEq for Hsl<S, T>
source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
source§impl<S, T> SubAssign<T> for Hsl<S, T>
impl<S, T> SubAssign<T> for Hsl<S, T>
source§fn sub_assign(&mut self, c: T)
fn sub_assign(&mut self, c: T)
-=
operation. Read moresource§impl<S, T> SubAssign for Hsl<S, T>
impl<S, T> SubAssign for Hsl<S, T>
source§fn sub_assign(&mut self, other: Hsl<S, T>)
fn sub_assign(&mut self, other: Hsl<S, T>)
-=
operation. Read moresource§impl<S, T> UlpsEq for Hsl<S, T>
impl<S, T> UlpsEq for Hsl<S, T>
impl<S, T> Copy for Hsl<S, T>
impl<S, T> StructuralPartialEq for Hsl<S, T>
Auto Trait Implementations§
impl<S, T> RefUnwindSafe for Hsl<S, T>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<S, T> Send for Hsl<S, T>
impl<S, T> Sync for Hsl<S, T>
impl<S, T> Unpin for Hsl<S, T>
impl<S, T> UnwindSafe for Hsl<S, T>where
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for Dwhere
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColor<Swp, T>,
D: FromColor<Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for Dwhere
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColor<Swp, T>,
D: FromColor<Dwp, T>,
source§fn adapt_from_using<M>(color: S, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_from_using<M>(color: S, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_from(color: S) -> Self
fn adapt_from(color: S) -> Self
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, U> ConvertFrom<T> for U
impl<T, U> ConvertFrom<T> for U
source§fn convert_from(t: T) -> U
fn convert_from(t: T) -> U
source§fn try_convert_from(t: T) -> Result<U, OutOfBounds<U>>
fn try_convert_from(t: T) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read moresource§fn convert_unclamped_from(val: T) -> Self
fn convert_unclamped_from(val: T) -> Self
source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more