Struct nannou_core::color::Hsl [−][src]
#[repr(C)]pub struct Hsl<S = Srgb, T = f32> where
T: Component + Float,
S: RgbSpace, {
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
Linear HSL.
Convert to a (hue, saturation, lightness)
tuple.
Trait Implementations
type Epsilon = <T as AbsDiffEq<T>>::Epsilon
type Epsilon = <T as AbsDiffEq<T>>::Epsilon
Used for specifying relative comparisons.
The default tolerance to use when testing values that are close together. Read more
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of ApproxEq::abs_diff_eq
.
Performs the +=
operation. Read more
Performs the +=
operation. Read more
impl<'de, S, T> Deserialize<'de> for Hsl<S, T> where
T: Component + Float + Deserialize<'de>,
S: RgbSpace,
impl<'de, S, T> Deserialize<'de> for Hsl<S, T> where
T: Component + Float + Deserialize<'de>,
S: RgbSpace,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Hsl<S, T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Hsl<S, T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<S, T> From<Hsl<<S as RgbStandard>::Space, T>> for Alpha<Rgb<S, T>, T> where
S: RgbStandard,
T: Component + Float,
impl<S, T> From<Hsl<<S as RgbStandard>::Space, T>> for Alpha<Rgb<S, T>, T> where
S: RgbStandard,
T: Component + Float,
impl<S, T, Sp, Wp> From<Hsl<Sp, T>> for Rgb<S, T> where
S: RgbStandard,
T: Component + Float,
Wp: WhitePoint,
Sp: RgbSpace<WhitePoint = Wp>,
<S as RgbStandard>::Space: RgbSpace,
<<S as RgbStandard>::Space as RgbSpace>::WhitePoint == Wp,
impl<S, T, Sp, Wp> From<Hsl<Sp, T>> for Rgb<S, T> where
S: RgbStandard,
T: Component + Float,
Wp: WhitePoint,
Sp: RgbSpace<WhitePoint = Wp>,
<S as RgbStandard>::Space: RgbSpace,
<<S as RgbStandard>::Space as RgbSpace>::WhitePoint == Wp,
impl<S, T, _S> From<Hsl<_S, T>> for Luma<S, T> where
T: Component + Float,
S: LumaStandard,
_S: RgbSpace<WhitePoint = <S as LumaStandard>::WhitePoint>,
impl<S, T, _S> From<Hsl<_S, T>> for Luma<S, T> where
T: Component + Float,
S: LumaStandard,
_S: RgbSpace<WhitePoint = <S as LumaStandard>::WhitePoint>,
impl<S, T, _S> From<Hsl<_S, T>> for Alpha<Luma<S, T>, T> where
T: Component + Float,
S: LumaStandard,
_S: RgbSpace<WhitePoint = <S as LumaStandard>::WhitePoint>,
impl<S, T, _S> From<Hsl<_S, T>> for Alpha<Luma<S, T>, T> where
T: Component + Float,
S: LumaStandard,
_S: RgbSpace<WhitePoint = <S as LumaStandard>::WhitePoint>,
impl<S, T, _S> From<Luma<_S, T>> for Hsl<S, T> where
T: Component + Float,
S: RgbSpace,
_S: LumaStandard<WhitePoint = <S as RgbSpace>::WhitePoint>,
impl<S, T, _S> From<Luma<_S, T>> for Hsl<S, T> where
T: Component + Float,
S: RgbSpace,
_S: LumaStandard<WhitePoint = <S as RgbSpace>::WhitePoint>,
Convert from XYZ color space
Convert from RGB color space
Convert from HSV color space
Convert from HSL color space
Convert from HWB color space
Return a new copy of self
, but with a specific hue.
Convert into RGB color space.
Convert into HSL color space
Convert into HSV color space
Convert self into RGBA.
Return a new color where the components has been clamped to the nearest valid values. Read more
Clamp the color’s components to the nearest valid values.
Cast as a reference to raw color components.
Cast as a mutable reference to raw color components.
Convert from raw color components.
Cast from a reference to raw color components.
Cast from a mutable reference to raw color components.
Cast a slice of raw color components to a slice of colors. Read more
Cast a mutable slice of raw color components to a mutable slice of colors. Read more
Cast a slice of colors to a slice of raw color components. Read more
The default relative tolerance for testing values that are far-apart. Read more
A test for equality that uses a relative comparison if the values are far apart.
fn 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 ApproxEq::relative_eq
.
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Performs the -=
operation. Read more
Performs the -=
operation. Read more
The default ULPs to tolerate when testing values that are far-apart. Read more
A test for equality that uses units in the last place (ULP) if the values are far apart.
Auto Trait Implementations
impl<S, T> RefUnwindSafe for Hsl<S, T> where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<S, T> UnwindSafe for Hsl<S, T> where
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
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 D where
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColor<Swp, T>,
D: FromColor<Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
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: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
Mutably borrows from an owned value. Read more
Convert from T with values clamped to the color defined bounds Read more
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
Convert from T. The resulting color might be invalid in its color space Read more
Convert into T with values clamped to the color defined bounds Read more
Convert into T. The resulting color might be invalid in its color space Read more
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