Trait cssparser_color::FromParsedColor
source · pub trait FromParsedColor {
// Required methods
fn from_current_color() -> Self;
fn from_rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Self;
fn from_hsl(
hue: Option<f32>,
saturation: Option<f32>,
lightness: Option<f32>,
alpha: Option<f32>
) -> Self;
fn from_hwb(
hue: Option<f32>,
whiteness: Option<f32>,
blackness: Option<f32>,
alpha: Option<f32>
) -> Self;
fn from_lab(
lightness: Option<f32>,
a: Option<f32>,
b: Option<f32>,
alpha: Option<f32>
) -> Self;
fn from_lch(
lightness: Option<f32>,
chroma: Option<f32>,
hue: Option<f32>,
alpha: Option<f32>
) -> Self;
fn from_oklab(
lightness: Option<f32>,
a: Option<f32>,
b: Option<f32>,
alpha: Option<f32>
) -> Self;
fn from_oklch(
lightness: Option<f32>,
chroma: Option<f32>,
hue: Option<f32>,
alpha: Option<f32>
) -> Self;
fn from_color_function(
color_space: PredefinedColorSpace,
c1: Option<f32>,
c2: Option<f32>,
c3: Option<f32>,
alpha: Option<f32>
) -> Self;
}
Expand description
This trait is used by the ColorParser
to construct colors of any type.
Required Methods§
sourcefn from_current_color() -> Self
fn from_current_color() -> Self
Construct a new color from the CSS currentcolor
keyword.
sourcefn from_rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Self
fn from_rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Self
Construct a new color from red, green, blue and alpha components.
sourcefn 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
Construct a new color from hue, saturation, lightness and alpha components.
sourcefn from_hwb(
hue: Option<f32>,
whiteness: Option<f32>,
blackness: Option<f32>,
alpha: Option<f32>
) -> Self
fn from_hwb( hue: Option<f32>, whiteness: Option<f32>, blackness: Option<f32>, alpha: Option<f32> ) -> Self
Construct a new color from hue, blackness, whiteness and alpha components.
sourcefn 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
Construct a new color from the lab
notation.
sourcefn 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
Construct a new color from the lch
notation.
sourcefn 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
Construct a new color from the oklab
notation.