Trait palette::FromColor [] [src]

pub trait FromColor<T>: Sized where
    T: Float
{ fn from_xyz(_: Xyz<T>) -> Self; fn from_yxy(inp: Yxy<T>) -> Self { ... } fn from_lab(inp: Lab<T>) -> Self { ... } fn from_lch(inp: Lch<T>) -> Self { ... } fn from_rgb(inp: Rgb<T>) -> Self { ... } fn from_hsl(inp: Hsl<T>) -> Self { ... } fn from_hsv(inp: Hsv<T>) -> Self { ... } fn from_hwb(inp: Hwb<T>) -> Self { ... } fn from_luma(inp: Luma<T>) -> Self { ... } }

FromColor provides conversion between the colors.

It requires from_xyz and derives conversion to other colors as a default from this. These defaults must be overridden when direct conversion exists between colors. For example, Luma has direct conversion to Rgb. So from_rgb conversion for Luma and from_luma for Rgb is implemented directly. The from for the same color must override the default. For example, from_rgb for Rgb will convert via Xyz which needs to be overridden with self to avoid the unnecessary converison.

Required Methods

Convert from XYZ color space

Provided Methods

Convert from Yxy color space

Convert from L*a*b* color space

Convert from L*C*h° color space

Convert from RGB color space

Convert from HSL color space

Convert from HSV color space

Convert from HWB color space

Convert from Luma

Implementors