[][src]Struct prisma::Hsl

#[repr(C)]pub struct Hsl<T, A = Deg<T>> { /* fields omitted */ }

The HSL device-dependent polar color model

hsl-diagram

HSL is defined by a hue (base color), saturation (color richness) and value (whiteness). Like HSV, HSL is modeled as a cylinder, however the underlying space is two cones stacked bottom-to-bottom. /// This causes some level of distortion and a degeneracy at S=0 or L={0,1}. Thus, while easy to reason about, it is not good for perceptual uniformity. It does an okay job with averaging colors or doing other math, but prefer the CIE spaces for uniform gradients.

Hsl takes two type parameters: the cartesian channel scalar, and an angular channel scalar.

Hsl is in the same color space and encoding as the parent RGB space, it is merely a geometric transformation and distortion.

For an undistorted device-dependent polar color model, look at Hsi.

Implementations

impl<T, A> Hsl<T, A> where
    T: PosNormalChannelScalar,
    A: AngularChannelScalar
[src]

pub fn new(hue: A, saturation: T, lightness: T) -> Self[src]

Construct an Hsl instance from hue, saturation and lightness

pub fn color_cast<TOut, AOut>(&self) -> Hsl<TOut, AOut> where
    T: ChannelFormatCast<TOut>,
    A: ChannelFormatCast<AOut>,
    AOut: AngularChannelScalar,
    TOut: PosNormalChannelScalar
[src]

Convert the internal channel scalar format

pub fn hue(&self) -> A[src]

Returns the hue scalar

pub fn saturation(&self) -> T[src]

Returns the saturation scalar

pub fn lightness(&self) -> T[src]

Returns the lightness scalar

pub fn hue_mut(&mut self) -> &mut A[src]

Returns a mutable reference to the hue scalar

pub fn saturation_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the saturation scalar

pub fn lightness_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the lightness scalar

pub fn set_hue(&mut self, val: A)[src]

Set the hue channel value

pub fn set_saturation(&mut self, val: T)[src]

Set the saturation channel value

pub fn set_lightness(&mut self, val: T)[src]

Set the lightness channel value

Trait Implementations

impl<T, A> AbsDiffEq<Hsl<T, A>> for Hsl<T, A> where
    T: PosNormalChannelScalar + AbsDiffEq<Epsilon = A::Epsilon>,
    A: AngularChannelScalar + AbsDiffEq,
    A::Epsilon: Clone + Float
[src]

type Epsilon = T::Epsilon

Used for specifying relative comparisons.

impl<T, A> Bounded for Hsl<T, A> where
    T: PosNormalChannelScalar,
    A: AngularChannelScalar
[src]

impl<T: Clone, A: Clone> Clone for Hsl<T, A>[src]

impl<T, A> Color for Hsl<T, A> where
    T: PosNormalChannelScalar,
    A: AngularChannelScalar
[src]

type Tag = HslTag

The unique tag unit struct identifying the color type

type ChannelsTuple = (A, T, T)

A tuple of types for each channel in the color

impl<T: Copy, A: Copy> Copy for Hsl<T, A>[src]

impl<T: Debug, A: Debug> Debug for Hsl<T, A>[src]

impl<T, A> Default for Hsl<T, A> where
    T: PosNormalChannelScalar + Zero,
    A: AngularChannelScalar + Zero
[src]

impl<T, A> Display for Hsl<T, A> where
    T: PosNormalChannelScalar + Display,
    A: AngularChannelScalar + Display
[src]

impl<T, A> EncodableColor for Hsl<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar + Angle<Scalar = T> + FromAngle<Turns<T>>, 
[src]

impl<T, A> From<Hsl<T, A>> for Rgb<T> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

impl<T, A> From<Rgb<T>> for Hsl<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar + FromAngle<Turns<T>>, 
[src]

impl<T, A> FromColor<Hsl<T, A>> for Rgb<T> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar
[src]

impl<T, A> FromColor<Rgb<T>> for Hsl<T, A> where
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar + FromAngle<Turns<T>>, 
[src]

impl<T, A> FromTuple for Hsl<T, A> where
    T: PosNormalChannelScalar,
    A: AngularChannelScalar
[src]

impl<T: Hash, A: Hash> Hash for Hsl<T, A>[src]

impl<T, A> Invert for Hsl<T, A> where
    T: PosNormalChannelScalar,
    A: AngularChannelScalar
[src]

impl<T, A> Lerp for Hsl<T, A> where
    T: PosNormalChannelScalar + Lerp,
    A: AngularChannelScalar + Lerp
[src]

type Position = A::Position

The type of the pos argument

impl<T: PartialEq, A: PartialEq> PartialEq<Hsl<T, A>> for Hsl<T, A>[src]

impl<T: PartialOrd, A: PartialOrd> PartialOrd<Hsl<T, A>> for Hsl<T, A>[src]

impl<T, A> PolarColor for Hsl<T, A> where
    T: PosNormalChannelScalar,
    A: AngularChannelScalar
[src]

type Angular = A

The angular channel's scalar type

type Cartesian = T

The remaining channels' scalar types

impl<T, A> RelativeEq<Hsl<T, A>> for Hsl<T, A> where
    T: PosNormalChannelScalar + RelativeEq<Epsilon = A::Epsilon>,
    A: AngularChannelScalar + RelativeEq,
    A::Epsilon: Clone + Float
[src]

impl<T, A> StructuralPartialEq for Hsl<T, A>[src]

impl<T, A> UlpsEq<Hsl<T, A>> for Hsl<T, A> where
    T: PosNormalChannelScalar + UlpsEq<Epsilon = A::Epsilon>,
    A: AngularChannelScalar + UlpsEq,
    A::Epsilon: Clone + Float
[src]

Auto Trait Implementations

impl<T, A> RefUnwindSafe for Hsl<T, A> where
    A: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, A> Send for Hsl<T, A> where
    A: Send,
    T: Send

impl<T, A> Sync for Hsl<T, A> where
    A: Sync,
    T: Sync

impl<T, A> Unpin for Hsl<T, A> where
    A: Unpin,
    T: Unpin

impl<T, A> UnwindSafe for Hsl<T, A> where
    A: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.