[−][src]Trait nannou::color::GetHue
A trait for colors where a hue may be calculated.
use palette::{Rgb, GetHue}; let red = Rgb::new(1.0f32, 0.0, 0.0); let green = Rgb::new(0.0f32, 1.0, 0.0); let blue = Rgb::new(0.0f32, 0.0, 1.0); let gray = Rgb::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.
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
.
Implementors
impl<C, T> GetHue for Alpha<C, T> where
C: GetHue,
T: Float,
[src]
C: GetHue,
T: Float,
impl<T> GetHue for Color<T> where
T: Float,
[src]
T: Float,
impl<T> GetHue for Hwb<T> where
T: Float,
[src]
T: Float,
impl<T> GetHue for Lab<T> where
T: Float,
[src]
T: Float,
impl<T> GetHue for Lch<T> where
T: Float,
[src]
T: Float,
impl<T> GetHue for Hsl<T> where
T: Float,
[src]
T: Float,
impl<T> GetHue for Hsv<T> where
T: Float,
[src]
T: Float,
impl<T> GetHue for Rgb<T> where
T: Float,
[src]
T: Float,