[][src]Struct scarlet::colors::hsvcolor::HSVColor

pub struct HSVColor {
    pub h: f64,
    pub s: f64,
    pub v: f64,
}

An HSV color, defining parameters for hue, saturation, and value from the RGB space. This is sHSV to be exact, but the derivation from the sRGB space is assumed as it matches the vast majority of colors called RGB.

Example

As with HSL, changing a red to a yellow results in a lightness increase as well.

let red = HSVColor{h: 0., s: 0.5, v: 0.8};
let yellow = HSVColor{h: 50., s: 0.5, v: 0.8};
println!("{} {}", red.convert::<RGBColor>().to_string(), yellow.convert::<RGBColor>().to_string());
// prints #CC6666 #CCBB66
// note how the second one is strictly more light

Fields

h: f64

The hue, described as an angle that ranges between 0 and 360 in degrees. While values outside of this range may not break, they shouldn't be treated as valid.

s: f64

The saturation, defined as the radius of the HSV cylinder and the distance between the color and the equivalent-value grayscale. Ranges between 0 and 1.

v: f64

The value, defined as the largest RGB primary value of a color. This corresponds to something close to color intensity, not really luminance: dark purple and white are the same value, for example.

Trait Implementations

impl Bound for HSVColor[src]

impl Clone for HSVColor[src]

impl Color for HSVColor[src]

fn from_xyz(xyz: XYZColor) -> HSVColor[src]

Converts to HSV by going through sRGB.

fn to_xyz(&self, illuminant: Illuminant) -> XYZColor[src]

Converts from HSV back to XYZ. Any illuminant other than D65 is computed using chromatic adaptation.

impl Copy for HSVColor[src]

impl Debug for HSVColor[src]

impl<'de> Deserialize<'de> for HSVColor[src]

impl From<Coord> for HSVColor[src]

impl FromStr for HSVColor[src]

type Err = CSSParseError

The associated error which can be returned from parsing.

impl Into<Coord> for HSVColor[src]

impl Serialize for HSVColor[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> ColorPoint for T where
    T: Color + Clone + Into<Coord> + From<Coord> + Copy
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.