[−][src]Struct scarlet::colors::hsvcolor::HSVColor
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]
fn bounds() -> [(f64, f64); 3]
[src]
fn clamp_coord(point: Coord) -> Coord
[src]
fn clamp<T: ColorPoint>(color: T) -> T
[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.
fn convert<T: Color>(&self) -> T
[src]
fn hue(&self) -> f64
[src]
fn set_hue(&mut self, new_hue: f64)
[src]
fn lightness(&self) -> f64
[src]
fn set_lightness(&mut self, new_lightness: f64)
[src]
fn chroma(&self) -> f64
[src]
fn set_chroma(&mut self, new_chroma: f64)
[src]
fn saturation(&self) -> f64
[src]
fn set_saturation(&mut self, new_sat: f64)
[src]
fn grayscale(&self) -> Self where
Self: Sized,
[src]
Self: Sized,
fn distance<T: Color>(&self, other: &T) -> f64
[src]
fn visually_indistinguishable<T: Color>(&self, other: &T) -> bool
[src]
impl Copy for HSVColor
[src]
impl Debug for HSVColor
[src]
impl<'de> Deserialize<'de> for HSVColor
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl From<Coord> for HSVColor
[src]
impl FromStr for HSVColor
[src]
type Err = CSSParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<HSVColor, CSSParseError>
[src]
impl Into<Coord> for HSVColor
[src]
impl Serialize for HSVColor
[src]
Auto Trait Implementations
impl RefUnwindSafe for HSVColor
impl Send for HSVColor
impl Sync for HSVColor
impl Unpin for HSVColor
impl UnwindSafe for HSVColor
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> ColorPoint for T where
T: Color + Clone + Into<Coord> + From<Coord> + Copy,
[src]
T: Color + Clone + Into<Coord> + From<Coord> + Copy,
fn euclidean_distance(self, other: Self) -> f64
[src]
fn weighted_midpoint(self, other: Self, weight: f64) -> Self
[src]
fn midpoint(self, other: Self) -> Self
[src]
fn weighted_average(
self,
others: Vec<Self>,
weights: Vec<f64>
) -> Result<Self, ColorCalcError>
[src]
self,
others: Vec<Self>,
weights: Vec<f64>
) -> Result<Self, ColorCalcError>
fn average(self, others: Vec<Self>) -> Coord
[src]
fn is_imaginary(&self) -> bool
[src]
fn closest_real_color(&self) -> Self
[src]
fn gradient_scale(&self, other: &Self, n: usize) -> Vec<Self>
[src]
fn gradient(&self, other: &Self) -> Box<dyn Fn(f64) -> Self>
[src]
fn cbrt_gradient(&self, other: &Self) -> Box<dyn Fn(f64) -> Self>
[src]
fn padded_gradient(
&self,
other: &Self,
lower_pad: f64,
upper_pad: f64
) -> Box<dyn Fn(f64) -> Self>
[src]
&self,
other: &Self,
lower_pad: f64,
upper_pad: f64
) -> Box<dyn Fn(f64) -> Self>
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,