Struct palette::Hsl [] [src]

pub struct Hsl {
    pub hue: RgbHue,
    pub saturation: f32,
    pub lightness: f32,
    pub alpha: f32,
}

Linear HSL color space with an alpha component.

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

The hue of the color, in degrees. Decides if it's red, blue, purple, etc.

saturation: f32

The colorfulness of the color. 0.0 gives gray scale colors and 1.0 will give absolutely clear colors.

lightness: f32

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.

alpha: f32

The transparency of the color. 0.0 is completely transparent and 1.0 is completely opaque.

Methods

impl Hsl
[src]

fn hsl(hue: RgbHue, saturation: f32, lightness: f32) -> Hsl

Linear HSL.

fn hsla(hue: RgbHue, saturation: f32, lightness: f32, alpha: f32) -> Hsl

Linear HSL and transparency.

Trait Implementations

impl PartialEq for Hsl
[src]

fn eq(&self, __arg_0: &Hsl) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Hsl) -> bool

This method tests for !=.

impl Debug for Hsl
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Copy for Hsl
[src]

impl Clone for Hsl
[src]

fn clone(&self) -> Hsl

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl ColorSpace for Hsl
[src]

fn is_valid(&self) -> bool

Check if the color's components are within the expected ranges.

fn clamp(&self) -> Hsl

Return a new color where the components has been clamped to the nearest valid values. Read more

fn clamp_self(&mut self)

Clamp the color's components to the nearest valid values.

impl Mix for Hsl
[src]

fn mix(&self, other: &Hsl, factor: f32) -> Hsl

Mix the color with an other color, by factor. Read more

impl Shade for Hsl
[src]

fn lighten(&self, amount: f32) -> Hsl

Lighten the color by amount.

fn darken(&self, amount: f32) -> Self

Darken the color by amount.

impl GetHue for Hsl
[src]

type Hue = RgbHue

The kind of hue unit this color space uses. Read more

fn get_hue(&self) -> Option<RgbHue>

Calculate a hue if possible. Read more

impl Hue for Hsl
[src]

fn with_hue(&self, hue: RgbHue) -> Hsl

Return a new copy of self, but with a specific hue.

fn shift_hue(&self, amount: RgbHue) -> Hsl

Return a new copy of self, but with the hue shifted by amount.

impl Saturate for Hsl
[src]

fn saturate(&self, factor: f32) -> Hsl

Increase the saturation by factor.

fn desaturate(&self, factor: f32) -> Self

Decrease the saturation by factor.

impl Default for Hsl
[src]

fn default() -> Hsl

Returns the "default value" for a type. Read more

impl From<Color> for Hsl
[src]

fn from(color: Color) -> Hsl

Performs the conversion.

impl From<Rgb> for Hsl
[src]

fn from(rgb: Rgb) -> Hsl

Performs the conversion.

impl From<Luma> for Hsl
[src]

fn from(luma: Luma) -> Hsl

Performs the conversion.

impl From<Xyz> for Hsl
[src]

fn from(xyz: Xyz) -> Hsl

Performs the conversion.

impl From<Lab> for Hsl
[src]

fn from(lab: Lab) -> Hsl

Performs the conversion.

impl From<Lch> for Hsl
[src]

fn from(lch: Lch) -> Hsl

Performs the conversion.

impl From<Hsv> for Hsl
[src]

fn from(hsv: Hsv) -> Hsl

Performs the conversion.