[][src]Struct tropy::colour::Hsl

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

Color represented in HSL

Fields

h: f64

Hue in 0-360 degree

s: f64

Saturation in 0...1 (percent)

l: f64

Luminosity in 0...1 (percent)

Methods

impl HSL[src]

pub fn from_rgb(rgb: &[u8]) -> 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.)

pub fn to_rgb(&self) -> (u8, u8, u8)[src]

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 Debug for HSL[src]

impl Copy for HSL[src]

impl Clone for HSL[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialOrd<HSL> for HSL[src]

impl PartialEq<HSL> for HSL[src]

impl Default for HSL[src]

impl From<HSL> for Rgb[src]

Auto Trait Implementations

impl Send for HSL

impl Sync for HSL

Blanket Implementations

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

type Owned = T

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.