Struct color_conv::hsl::Hsl[][src]

pub struct Hsl {
    pub hue: u16,
    pub saturation: u8,
    pub lightness: u8,
}

A representation of the HSL (cyan, magenta, yellow, key) color format.

Fields

hue: u16

Hue value (in degrees)

saturation: u8

Saturation percentage

lightness: u8

Lightness percentage

Implementations

impl Hsl[src]

pub fn new(hue: u16, saturation: u8, lightness: u8) -> Result<Self, Error>[src]

Returns a Result containing a new Hsl object given hue, saturation, and lightness values. Will return an Error if either the saturation or lightness are larger than 100 due to the fact that they represent percentages or the hue is greater than 360 because it represents a degree value.

Arguments

  • hue - the hue value of the color
  • saturation - the saturation value of the color
  • lightness - the lightness value of the color

Examples

use color_conv::Hsl;
let cyan = Hsl::new(180, 100, 50)?;

pub fn new_unchecked(hue: u16, saturation: u8, lightness: u8) -> Self[src]

See Hsl::new. Does not perform check to ensure that all parameters are valid. This is useful for when you know more than the compiler about which values are being passed to the method.

Examples

use color_conv::Hsl;
let cyan = Hsl::new_unchecked(180, 100, 50);

Trait Implementations

impl Clone for Hsl[src]

impl Color for Hsl[src]

impl Copy for Hsl[src]

impl Debug for Hsl[src]

impl Display for Hsl[src]

impl Eq for Hsl[src]

impl Hash for Hsl[src]

impl PartialEq<Hsl> for Hsl[src]

impl StructuralEq for Hsl[src]

impl StructuralPartialEq for Hsl[src]

Auto Trait Implementations

impl RefUnwindSafe for Hsl

impl Send for Hsl

impl Sync for Hsl

impl Unpin for Hsl

impl UnwindSafe for Hsl

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.