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
Provided Methods
fn from_yxy(inp: Yxy<T>) -> Self
Convert from Yxy color space
fn from_lab(inp: Lab<T>) -> Self
Convert from L*a*b* color space
fn from_lch(inp: Lch<T>) -> Self
Convert from L*C*h° color space
fn from_rgb(inp: Rgb<T>) -> Self
Convert from RGB color space
fn from_hsl(inp: Hsl<T>) -> Self
Convert from HSL color space
fn from_hsv(inp: Hsv<T>) -> Self
Convert from HSV color space
fn from_hwb(inp: Hwb<T>) -> Self
Convert from HWB color space
fn from_luma(inp: Luma<T>) -> Self
Convert from Luma
Implementors
impl<T: Float> FromColor<T> for Rgb<T>
impl<T: Float> FromColor<T> for Luma<T>
impl<T: Float> FromColor<T> for Yxy<T>
impl<T: Float> FromColor<T> for Xyz<T>
impl<T: Float> FromColor<T> for Lab<T>
impl<T: Float> FromColor<T> for Lch<T>
impl<T: Float> FromColor<T> for Hsv<T>
impl<T: Float> FromColor<T> for Hsl<T>
impl<T: Float> FromColor<T> for Hwb<T>