Struct palette::Hwb [] [src]

pub struct Hwb<T: Float = f32> {
    pub hue: RgbHue<T>,
    pub whiteness: T,
    pub blackness: T,
}

Linear HWB color space.

HWB is a cylindrical version of RGB and it's very closely related to HSV. It describes colors with a starting hue, then a degree of whiteness and blackness to mix into that base hue.

It is very intuitive for humans to use and many color-pickers are based on the HWB color system

Fields

hue: RgbHue<T>

The hue of the color, in degrees. Decides if it's red, blue, purple, etc. Same as the hue for HSL and HSV.

whiteness: T

The whiteness of the color. It specifies the amount white to mix into the hue. It varies from 0 to 1, with 1 being always full white and 0 always being the color shade (a mixture of a pure hue with black) chosen with the other two controls.

blackness: T

The blackness of the color. It specifies the amount black to mix into the hue. It varies from 0 to 1, with 1 being always full black and 0 always being the color tint (a mixture of a pure hue with white) chosen with the other two

Methods

impl<T: Float> Hwb<T>
[src]

fn new(hue: RgbHue<T>, whiteness: T, blackness: T) -> Hwb<T>

Linear HWB.

Trait Implementations

impl<T: PartialEq + Float> PartialEq for Hwb<T>
[src]

fn eq(&self, __arg_0: &Hwb<T>) -> bool

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

fn ne(&self, __arg_0: &Hwb<T>) -> bool

This method tests for !=.

impl<T: Debug + Float> Debug for Hwb<T>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<T: Copy + Float> Copy for Hwb<T>
[src]

impl<T: Clone + Float> Clone for Hwb<T>
[src]

fn clone(&self) -> Hwb<T>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<T: Float> FromColor<T> for Hwb<T>
[src]

fn from_xyz(xyz: Xyz<T>) -> Self

Convert from XYZ color space

fn from_hsv(hsv: Hsv<T>) -> Self

Convert from HSV color space

fn from_hwb(hwb: Hwb<T>) -> Self

Convert from HWB color space

fn from_yxy(inp: Yxy<T>) -> Self

Convert from Yxy color space

fn from_lab(inp: Lab<T>) -> Self

Convert from L*a*b* color space

fn from_lch(inp: Lch<T>) -> Self

Convert from L*C*h° color space

fn from_rgb(inp: Rgb<T>) -> Self

Convert from RGB color space

fn from_hsl(inp: Hsl<T>) -> Self

Convert from HSL color space

fn from_luma(inp: Luma<T>) -> Self

Convert from Luma

impl<T: Float> Limited for Hwb<T>
[src]

fn is_valid(&self) -> bool

Check if the color's components are within the expected ranges.

fn clamp(&self) -> Hwb<T>

Return a new color where the components has been clamped to the nearest valid values. Read more

fn clamp_self(&mut self)

Clamp the color's components to the nearest valid values.

impl<T: Float> Mix for Hwb<T>
[src]

type Scalar = T

The type of the mixing factor.

fn mix(&self, other: &Hwb<T>, factor: T) -> Hwb<T>

Mix the color with an other color, by factor. Read more

impl<T: Float> Shade for Hwb<T>
[src]

type Scalar = T

The type of the lighten/darken amount.

fn lighten(&self, amount: T) -> Hwb<T>

Lighten the color by amount.

fn darken(&self, amount: Self::Scalar) -> Self

Darken the color by amount.

impl<T: Float> GetHue for Hwb<T>
[src]

type Hue = RgbHue<T>

The kind of hue unit this color space uses. Read more

fn get_hue(&self) -> Option<RgbHue<T>>

Calculate a hue if possible. Read more

impl<T: Float> Hue for Hwb<T>
[src]

fn with_hue(&self, hue: RgbHue<T>) -> Hwb<T>

Return a new copy of self, but with a specific hue.

fn shift_hue(&self, amount: RgbHue<T>) -> Hwb<T>

Return a new copy of self, but with the hue shifted by amount.

impl<T: Float> Default for Hwb<T>
[src]

fn default() -> Hwb<T>

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

impl<T: Float> Add<Hwb<T>> for Hwb<T>
[src]

type Output = Hwb<T>

The resulting type after applying the + operator

fn add(self, other: Hwb<T>) -> Hwb<T>

The method for the + operator

impl<T: Float> Add<T> for Hwb<T>
[src]

type Output = Hwb<T>

The resulting type after applying the + operator

fn add(self, c: T) -> Hwb<T>

The method for the + operator

impl<T: Float> Sub<Hwb<T>> for Hwb<T>
[src]

type Output = Hwb<T>

The resulting type after applying the - operator

fn sub(self, other: Hwb<T>) -> Hwb<T>

The method for the - operator

impl<T: Float> Sub<T> for Hwb<T>
[src]

type Output = Hwb<T>

The resulting type after applying the - operator

fn sub(self, c: T) -> Hwb<T>

The method for the - operator

impl<T: Float> IntoColor<T> for Hwb<T>
[src]

fn into_xyz(self) -> Xyz<T>

Convert into XYZ space

fn into_yxy(self) -> Yxy<T>

Convert into Yxy color space

fn into_lab(self) -> Lab<T>

Convert into L*a*b* color space

fn into_lch(self) -> Lch<T>

Convert into L*C*h° color space

fn into_rgb(self) -> Rgb<T>

Convert into RGB color space.

fn into_hsl(self) -> Hsl<T>

Convert into HSL color space

fn into_hsv(self) -> Hsv<T>

Convert into HSV color space

fn into_luma(self) -> Luma<T>

Convert into Luma

fn into_hwb(self) -> Hwb<T>

Convert into HWB color space

impl<T: Float> From<Alpha<Hwb<T>, T>> for Hwb<T>
[src]

fn from(color: Alpha<Hwb<T>, T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Color<T>> for Hwb<T>
[src]

fn from(color: Color<T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Xyz<T>> for Hwb<T>
[src]

fn from(other: Xyz<T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Alpha<Xyz<T>, T>> for Hwb<T>
[src]

fn from(other: Alpha<Xyz<T>, T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Yxy<T>> for Hwb<T>
[src]

fn from(other: Yxy<T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Alpha<Yxy<T>, T>> for Hwb<T>
[src]

fn from(other: Alpha<Yxy<T>, T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Lab<T>> for Hwb<T>
[src]

fn from(other: Lab<T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Alpha<Lab<T>, T>> for Hwb<T>
[src]

fn from(other: Alpha<Lab<T>, T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Lch<T>> for Hwb<T>
[src]

fn from(other: Lch<T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Alpha<Lch<T>, T>> for Hwb<T>
[src]

fn from(other: Alpha<Lch<T>, T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Rgb<T>> for Hwb<T>
[src]

fn from(other: Rgb<T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Alpha<Rgb<T>, T>> for Hwb<T>
[src]

fn from(other: Alpha<Rgb<T>, T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Hsl<T>> for Hwb<T>
[src]

fn from(other: Hsl<T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Alpha<Hsl<T>, T>> for Hwb<T>
[src]

fn from(other: Alpha<Hsl<T>, T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Hsv<T>> for Hwb<T>
[src]

fn from(other: Hsv<T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Alpha<Hsv<T>, T>> for Hwb<T>
[src]

fn from(other: Alpha<Hsv<T>, T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Luma<T>> for Hwb<T>
[src]

fn from(other: Luma<T>) -> Hwb<T>

Performs the conversion.

impl<T: Float> From<Alpha<Luma<T>, T>> for Hwb<T>
[src]

fn from(other: Alpha<Luma<T>, T>) -> Hwb<T>

Performs the conversion.

impl<T: Float + ApproxEq> ApproxEq for Hwb<T> where T::Epsilon: Copy + Float
[src]

type Epsilon = T::Epsilon

Used for specifying relative comparisons.

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more

fn relative_eq(&self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon) -> bool

A test for equality that uses a relative comparison if the values are far apart.

fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.

fn relative_ne(&self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon) -> bool

The inverse of ApproxEq::relative_eq.

fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of ApproxEq::ulps_eq.