Struct Hsl
pub struct Hsl;Expand description
๐ The HSL color space
The HSL color space is fairly widely used and convenient, but it is not based on sound color science. Among its flaws, colors with the same โlightnessโ value can have wildly varying perceptual lightness.
Its components are [H, S, L] with
H- the hue angle in degrees, with red at 0, green at 120, and blue at 240.S- the saturation, where 0 is gray and 100 is maximally saturated.L- the lightness, where 0 is black and 100 is white.
This corresponds to the color space in CSS Color Module Level 4 ยง 7.
Trait Implementationsยง
ยงimpl ColorSpace for Hsl
impl ColorSpace for Hsl
ยงconst TAG: Option<ColorSpaceTag>
const TAG: Option<ColorSpaceTag>
The tag corresponding to this color space, if a matching tag exists.
ยงconst LAYOUT: ColorSpaceLayout = ColorSpaceLayout::HueFirst
const LAYOUT: ColorSpaceLayout = ColorSpaceLayout::HueFirst
The layout of the color space. Read more
ยงconst WHITE_COMPONENTS: [f32; 3]
const WHITE_COMPONENTS: [f32; 3]
The component values for the color white within this color space.
ยงfn scale_chroma(_: [f32; 3], scale: f32) -> [f32; 3]
fn scale_chroma(_: [f32; 3], scale: f32) -> [f32; 3]
Scale the chroma by the given amount. Read more
ยงfn convert<TargetCS>(src: [f32; 3]) -> [f32; 3]where
TargetCS: ColorSpace,
fn convert<TargetCS>(src: [f32; 3]) -> [f32; 3]where
TargetCS: ColorSpace,
Convert to a different color space. Read more
ยงfn clip(_: [f32; 3]) -> [f32; 3]
fn clip(_: [f32; 3]) -> [f32; 3]
Clip the colorโs components to fit within the natural gamut of the color space. Read more
ยงconst WHITE_POINT: Chromaticity = Chromaticity::D65
const WHITE_POINT: Chromaticity = Chromaticity::D65
The white point of the color space. Read more
ยงfn to_linear_srgb_absolute(src: [f32; 3]) -> [f32; 3]
fn to_linear_srgb_absolute(src: [f32; 3]) -> [f32; 3]
Convert an opaque color to linear sRGB, without chromatic adaptation. Read more
ยงfn from_linear_srgb_absolute(src: [f32; 3]) -> [f32; 3]
fn from_linear_srgb_absolute(src: [f32; 3]) -> [f32; 3]
Convert an opaque color from linear sRGB, without chromatic adaptation. Read more
ยงfn convert_absolute<TargetCS>(src: [f32; 3]) -> [f32; 3]where
TargetCS: ColorSpace,
fn convert_absolute<TargetCS>(src: [f32; 3]) -> [f32; 3]where
TargetCS: ColorSpace,
Convert to a different color space, without chromatic adaptation. Read more
ยงfn chromatically_adapt(
src: [f32; 3],
from: Chromaticity,
to: Chromaticity,
) -> [f32; 3]
fn chromatically_adapt( src: [f32; 3], from: Chromaticity, to: Chromaticity, ) -> [f32; 3]
Chromatically adapt the color between the given white point chromaticities. Read more
ยงimpl From<Hsl> for ColorSpaceTag
impl From<Hsl> for ColorSpaceTag
ยงfn from(_: Hsl) -> ColorSpaceTag
fn from(_: Hsl) -> ColorSpaceTag
Converts to this type from the input type.
impl Copy for Hsl
Auto Trait Implementationsยง
impl Freeze for Hsl
impl RefUnwindSafe for Hsl
impl Send for Hsl
impl Sync for Hsl
impl Unpin for Hsl
impl UnwindSafe for Hsl
Blanket Implementationsยง
ยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
ยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
ยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยงunsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
๐ฌThis is a nightly-only experimental API. (
clone_to_uninit)ยงimpl<T> Instrument for T
impl<T> Instrument for T
ยงfn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
ยงfn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงimpl<T> StaticAnim for Twhere
T: StaticAnimRequirement + 'static,
impl<T> StaticAnim for Twhere
T: StaticAnimRequirement + 'static,
Sourceยงfn show(&self) -> AnimationCell<T>
fn show(&self) -> AnimationCell<T>
Show the item
Sourceยงfn hide(&self) -> AnimationCell<T>
fn hide(&self) -> AnimationCell<T>
Hide the item