Enum cssparser_color::Color
source · pub enum Color {
CurrentColor,
Rgba(RgbaLegacy),
Hsl(Hsl),
Hwb(Hwb),
Lab(Lab),
Lch(Lch),
Oklab(Oklab),
Oklch(Oklch),
ColorFunction(ColorFunction),
}
Expand description
Describes one of the value
Most components are Option<_>
, so when the value is None
, that component
serializes to the “none” keyword.
Variants§
CurrentColor
The ‘currentcolor’ keyword.
Rgba(RgbaLegacy)
Specify sRGB colors directly by their red/green/blue/alpha chanels.
Hsl(Hsl)
Specifies a color in sRGB using hue, saturation and lightness components.
Hwb(Hwb)
Specifies a color in sRGB using hue, whiteness and blackness components.
Lab(Lab)
Specifies a CIELAB color by CIE Lightness and its a- and b-axis hue coordinates (red/green-ness, and yellow/blue-ness) using the CIE LAB rectangular coordinate model.
Lch(Lch)
Specifies a CIELAB color by CIE Lightness, Chroma, and hue using the CIE LCH cylindrical coordinate model.
Oklab(Oklab)
Specifies an Oklab color by Oklab Lightness and its a- and b-axis hue coordinates (red/green-ness, and yellow/blue-ness) using the Oklab rectangular coordinate model.
Oklch(Oklch)
Specifies an Oklab color by Oklab Lightness, Chroma, and hue using the OKLCH cylindrical coordinate model.
ColorFunction(ColorFunction)
Specifies a color in a predefined color space.
Implementations§
Trait Implementations§
source§impl FromParsedColor for Color
impl FromParsedColor for Color
source§fn from_current_color() -> Self
fn from_current_color() -> Self
currentcolor
keyword.source§fn from_rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Self
fn from_rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Self
source§fn from_hsl(
hue: Option<f32>,
saturation: Option<f32>,
lightness: Option<f32>,
alpha: Option<f32>
) -> Self
fn from_hsl( hue: Option<f32>, saturation: Option<f32>, lightness: Option<f32>, alpha: Option<f32> ) -> Self
source§fn from_hwb(
hue: Option<f32>,
blackness: Option<f32>,
whiteness: Option<f32>,
alpha: Option<f32>
) -> Self
fn from_hwb( hue: Option<f32>, blackness: Option<f32>, whiteness: Option<f32>, alpha: Option<f32> ) -> Self
source§fn from_lab(
lightness: Option<f32>,
a: Option<f32>,
b: Option<f32>,
alpha: Option<f32>
) -> Self
fn from_lab( lightness: Option<f32>, a: Option<f32>, b: Option<f32>, alpha: Option<f32> ) -> Self
lab
notation.source§fn from_lch(
lightness: Option<f32>,
chroma: Option<f32>,
hue: Option<f32>,
alpha: Option<f32>
) -> Self
fn from_lch( lightness: Option<f32>, chroma: Option<f32>, hue: Option<f32>, alpha: Option<f32> ) -> Self
lch
notation.source§fn from_oklab(
lightness: Option<f32>,
a: Option<f32>,
b: Option<f32>,
alpha: Option<f32>
) -> Self
fn from_oklab( lightness: Option<f32>, a: Option<f32>, b: Option<f32>, alpha: Option<f32> ) -> Self
oklab
notation.