Trait IColor

Source
pub trait IColor:
    From<Color>
    + From<ColorByte>
    + From<ColorHSLA>
    + ToColorRep<ColorRGBA = ColorRGBA, ColorHSLA = ColorHSLA, ColorRGBAByte = ColorRGBAByte> {
    const TRANSPARENT: Self;
    const BLACK: Self;
    const GRAY: Self;
    const WHITE: Self;
    const RED: Self;
    const GREEN: Self;
    const BLUE: Self;
    const CYAN: Self;
    const PINK: Self;
    const YELLOW: Self;

    // Required method
    fn rgba_from_bytes(r: u8, g: u8, b: u8, a: u8) -> Self;

    // Provided methods
    fn rgba_from_bytes_slice(rgba: &[u8]) -> Self { ... }
    fn from_rgb_hex(hex: u32) -> Self { ... }
    fn from_rgba_hex(hex: u32) -> Self { ... }
    fn to_rgba_hex(self) -> u32 { ... }
    fn to_rgba_hex_string(self) -> String { ... }
}

Required Associated Constants§

Source

const TRANSPARENT: Self

Source

const BLACK: Self

Source

const GRAY: Self

Source

const WHITE: Self

Source

const RED: Self

Source

const GREEN: Self

Source

const BLUE: Self

Source

const CYAN: Self

Source

const PINK: Self

Source

const YELLOW: Self

Required Methods§

Source

fn rgba_from_bytes(r: u8, g: u8, b: u8, a: u8) -> Self

Provided Methods§

Source

fn rgba_from_bytes_slice(rgba: &[u8]) -> Self

Source

fn from_rgb_hex(hex: u32) -> Self

Source

fn from_rgba_hex(hex: u32) -> Self

Source

fn to_rgba_hex(self) -> u32

Cast to color byte and convert to u32 using : #RRGGBBAA

Source

fn to_rgba_hex_string(self) -> String

Cast to color byte and format the color : #RRGGBBAA

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.

Implementors§

Source§

impl IColor for ColorHSLA

Source§

const TRANSPARENT: Self

Source§

const BLACK: Self

Source§

const GRAY: Self

Source§

const WHITE: Self

Source§

const RED: Self

Source§

const GREEN: Self

Source§

const BLUE: Self

Source§

const CYAN: Self

Source§

const PINK: Self

Source§

const YELLOW: Self

Source§

impl<T> IColor for ColorRGBAOf<T>
where Self: From<Color> + From<ColorByte> + From<ColorHSLA> + ToFloat<Output = ColorRGBAOf<float>>, T: ToCoef<Output = Coef> + FromCoef + ToFloat<Output = float> + DefaultRange + Copy + PartialEq + Default,

Source§

const TRANSPARENT: Self

Source§

const BLACK: Self

Source§

const GRAY: Self

Source§

const WHITE: Self

Source§

const RED: Self

Source§

const GREEN: Self

Source§

const BLUE: Self

Source§

const CYAN: Self

Source§

const PINK: Self

Source§

const YELLOW: Self