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§

source

fn from_current_color() -> Self

Construct a new color from the CSS currentcolor keyword.

source

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.

source

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.

source

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.

source

fn from_lab( lightness: Option<f32>, a: Option<f32>, b: Option<f32>, alpha: Option<f32> ) -> Self

Construct a new color from the lab notation.

source

fn from_lch( lightness: Option<f32>, chroma: Option<f32>, hue: Option<f32>, alpha: Option<f32> ) -> Self

Construct a new color from the lch notation.

source

fn from_oklab( lightness: Option<f32>, a: Option<f32>, b: Option<f32>, alpha: Option<f32> ) -> Self

Construct a new color from the oklab notation.

source

fn from_oklch( lightness: Option<f32>, chroma: Option<f32>, hue: Option<f32>, alpha: Option<f32> ) -> Self

Construct a new color from the oklch notation.

source

fn from_color_function( color_space: PredefinedColorSpace, c1: Option<f32>, c2: Option<f32>, c3: Option<f32>, alpha: Option<f32> ) -> Self

Construct a new color with a predefined color space.

Implementors§