[][src]Trait amethyst_rendy::palette::GetHue

pub trait GetHue {
    type Hue;
    fn get_hue(&self) -> Option<Self::Hue>;
}

A trait for colors where a hue may be calculated.

use palette::{GetHue, LinSrgb};

let red = LinSrgb::new(1.0f32, 0.0, 0.0);
let green = LinSrgb::new(0.0f32, 1.0, 0.0);
let blue = LinSrgb::new(0.0f32, 0.0, 1.0);
let gray = LinSrgb::new(0.5f32, 0.5, 0.5);

assert_eq!(red.get_hue(), Some(0.0.into()));
assert_eq!(green.get_hue(), Some(120.0.into()));
assert_eq!(blue.get_hue(), Some(240.0.into()));
assert_eq!(gray.get_hue(), None);

Associated Types

type Hue

The kind of hue unit this color space uses.

The hue is most commonly calculated as an angle around a color circle and may not always be uniform between color spaces. It's therefore not recommended to take one type of hue and apply it to a color space that expects an other.

Loading content...

Required methods

fn get_hue(&self) -> Option<Self::Hue>

Calculate a hue if possible.

Colors in the gray scale has no well defined hue and should preferably return None.

Loading content...

Implementors

impl<C, T> GetHue for Alpha<C, T> where
    C: GetHue
[src]

type Hue = <C as GetHue>::Hue

impl<S, T> GetHue for Color<S, T> where
    S: RgbSpace,
    T: Float + Component
[src]

type Hue = LabHue<T>

impl<S, T> GetHue for Rgb<S, T> where
    S: RgbStandard<TransferFn = LinearFn>,
    T: Component + Float
[src]

type Hue = RgbHue<T>

impl<S, T> GetHue for Hsl<S, T> where
    S: RgbSpace,
    T: Component + Float
[src]

type Hue = RgbHue<T>

impl<S, T> GetHue for Hsv<S, T> where
    S: RgbSpace,
    T: Component + Float
[src]

type Hue = RgbHue<T>

impl<S, T> GetHue for Hwb<S, T> where
    S: RgbSpace,
    T: Component + Float
[src]

type Hue = RgbHue<T>

impl<Wp, T> GetHue for Lab<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Hue = LabHue<T>

impl<Wp, T> GetHue for Lch<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Hue = LabHue<T>

Loading content...