pub trait FromParsedColor {
// Required methods
fn from_current_color() -> Self;
fn from_rgba(
red: Option<u8>,
green: Option<u8>,
blue: Option<u8>,
alpha: Option<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: Option<u8>,
green: Option<u8>,
blue: Option<u8>,
alpha: Option<f32>,
) -> Self
fn from_rgba( red: Option<u8>, green: Option<u8>, blue: Option<u8>, alpha: Option<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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.