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ยง
Sourceยงimpl ColorSpace for Hsl
impl ColorSpace for Hsl
Sourceยงconst TAG: Option<ColorSpaceTag>
const TAG: Option<ColorSpaceTag>
The tag corresponding to this color space, if a matching tag exists.
Sourceยงconst LAYOUT: ColorSpaceLayout = ColorSpaceLayout::HueFirst
const LAYOUT: ColorSpaceLayout = ColorSpaceLayout::HueFirst
The layout of the color space. Read more
Sourceยงconst WHITE_COMPONENTS: [f32; 3]
const WHITE_COMPONENTS: [f32; 3]
The component values for the color white within this color space.
Sourceยงfn from_linear_srgb(src: [f32; 3]) -> [f32; 3]
fn from_linear_srgb(src: [f32; 3]) -> [f32; 3]
Convert an opaque color from linear sRGB. Read more
Sourceยงfn to_linear_srgb(src: [f32; 3]) -> [f32; 3]
fn to_linear_srgb(src: [f32; 3]) -> [f32; 3]
Convert an opaque color to linear sRGB. Read more
Sourceยงfn scale_chroma([h, s, l]: [f32; 3], scale: f32) -> [f32; 3]
fn scale_chroma([h, s, l]: [f32; 3], scale: f32) -> [f32; 3]
Scale the chroma by the given amount. Read more
Sourceยงfn convert<TargetCS: ColorSpace>(src: [f32; 3]) -> [f32; 3]
fn convert<TargetCS: ColorSpace>(src: [f32; 3]) -> [f32; 3]
Convert to a different color space. Read more
Sourceยงfn clip([h, s, l]: [f32; 3]) -> [f32; 3]
fn clip([h, s, l]: [f32; 3]) -> [f32; 3]
Clip the colorโs components to fit within the natural gamut of the color space. Read more
Sourceยงconst WHITE_POINT: Chromaticity = Chromaticity::D65
const WHITE_POINT: Chromaticity = Chromaticity::D65
The white point of the color space. Read more
Sourceยง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
Sourceยง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
Sourceยงfn convert_absolute<TargetCS: ColorSpace>(src: [f32; 3]) -> [f32; 3]
fn convert_absolute<TargetCS: ColorSpace>(src: [f32; 3]) -> [f32; 3]
Convert to a different color space, without chromatic adaptation. Read more
Sourceยง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
Sourceยงimpl From<Hsl> for ColorSpaceTag
impl From<Hsl> for ColorSpaceTag
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ยง
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
Mutably borrows from an owned value. Read more