pub enum Color {
Rgba(Rgba),
Hsla(Hsla),
Hwba(Hwba),
}
Expand description
A color in sass/css. May be a Rgba, Hsla, or Hwba value.
Variants§
Rgba(Rgba)
A rgba color, defined by red, green, blue and alpha components.
Hsla(Hsla)
A hsla color, defined by its hue, saturation, lightness and alpha.
Hwba(Hwba)
A hwba color, defined by its hue, whiteness, blackness and alpha.
Implementations§
source§impl Color
impl Color
sourcepub fn to_rgba(&self) -> Cow<'_, Rgba>
pub fn to_rgba(&self) -> Cow<'_, Rgba>
Get this color as a rgba value.
If this color is a rgba value, return a borrow of it. Otherwise, do the conversion and return an owned value.
sourcepub fn to_hsla(&self) -> Cow<'_, Hsla>
pub fn to_hsla(&self) -> Cow<'_, Hsla>
Get this color as a hsla value.
If this color is a hsla value, return a borrow of it. Otherwise, do the conversion and return an owned value.
sourcepub fn to_hwba(&self) -> Cow<'_, Hwba>
pub fn to_hwba(&self) -> Cow<'_, Hwba>
Get this color as a hwba value.
If this color is a hwba value, return a borrow of it. Otherwise, do the conversion and return an owned value.
sourcepub fn get_alpha(&self) -> Rational
pub fn get_alpha(&self) -> Rational
Get the alpha channel of this color.
The alpha channel is a rational value between 0 and 1.
sourcepub fn set_alpha(&mut self, alpha: Rational)
pub fn set_alpha(&mut self, alpha: Rational)
Set the alpha channel of this color.
The alpha channel is a rational value between 0 and 1.
sourcepub fn rotate_hue(&self, val: Rational) -> Self
pub fn rotate_hue(&self, val: Rational) -> Self
Rotate the hue of this color by a specific number of degrees.
Trait Implementations§
source§impl Ord for Color
impl Ord for Color
source§impl PartialEq for Color
impl PartialEq for Color
source§impl PartialOrd for Color
impl PartialOrd for Color
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more