Trait Color

Source
pub trait Color {
    const TYPE: ColorType;

    // Provided methods
    fn get_rgba(&self) -> ColorRGBA { ... }
    fn get_hsva(&self) -> ColorHSVA { ... }
    fn get_hsla(&self) -> ColorHSLA { ... }
    fn get_hsia(&self) -> ColorHSIA { ... }
}
Expand description

Defines a single color which can be expressed in RGBA

Required Associated Constants§

Source

const TYPE: ColorType

The base color type, the get_x method of this color must be implemented while the others will be implemented automatically

Provided Methods§

Source

fn get_rgba(&self) -> ColorRGBA

Retrieves the RGBA color for this color

Source

fn get_hsva(&self) -> ColorHSVA

Retrieves the HSVA color for this color

Source

fn get_hsla(&self) -> ColorHSLA

Retrieves the HSLA color for this color

Source

fn get_hsia(&self) -> ColorHSIA

Retrieves the HSIA color for this color

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 Color for Grays

Source§

const TYPE: ColorType = ColorType::RGB

Source§

impl Color for ColorHSIA

Source§

const TYPE: ColorType = ColorType::HSI

Source§

impl Color for ColorHSLA

Source§

const TYPE: ColorType = ColorType::HSL

Source§

impl Color for ColorHSVA

Source§

const TYPE: ColorType = ColorType::HSV

Source§

impl Color for ColorRGBA

Source§

const TYPE: ColorType = ColorType::RGB