Struct hsl::HSL [] [src]

pub struct HSL {
    pub h: f64,
    pub s: f64,
    pub l: f64,
}

Color represented in HSL

Fields

Hue in 0-360 degree

Saturation in 0...1 (percent)

Luminosity in 0...1 (percent)

Methods

impl HSL
[src]

Convert RGB pixel value to HSL

Expects RGB pixel to be a slice of three u8s representing the red, green and blue values.

use hsl::HSL;
let blue = HSL::from_rgb(&[0, 0, 255]);

Algorithm from go-color by Brandon Thomson bt@brandonthomson.com. (Iternally converts the pixel to RGB before converting it to HSL.)

Convert HSL color to RGB

use hsl::HSL;

let cyan = HSL { h: 180_f64, s: 1_f64, l: 0.5_f64 };
assert_eq!(cyan.to_rgb(), (0, 255, 255));

Trait Implementations

impl Clone for HSL
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for HSL
[src]

impl Debug for HSL
[src]

Formats the value using the given formatter.

impl PartialEq for HSL
[src]

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

This method tests for !=.

impl PartialOrd for HSL
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Default for HSL
[src]

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