Skip to main content

IColor

Trait IColor 

Source
pub trait IColor: Sized + ToColor<Self::Component> {
    type Component: Primitive;
Show 19 associated constants and 7 methods const TRANSPARENT: Self; const BLACK: Self; const GREY: Self; const WHITE: Self; const RED: Self; const GREEN: Self; const BLUE: Self; const CYAN: Self; const MAGENTA: Self; const YELLOW: Self; const SPRING: Self; const AZURE: Self; const VIOLET: Self; const ROSE: Self; const ORANGE: Self; const LIME: Self; const CANARY: Self; const PINK: Self; const GLACE: Self; // Required methods fn to_rgba_of<R>(self) -> RgbaOf<R> where R: Primitive + CastRangeFrom<Self::Component>; fn to_hsla_of<R>(self) -> HslaOf<R> where R: Float + CastRangeFrom<Self::Component>; fn from_rgba_u8(rgba: RgbaOf<u8>) -> Self; fn from_rgba_u16(rgba: RgbaOf<u16>) -> Self; fn from_rgba_f32(rgba: RgbaOf<f32>) -> Self; fn from_rgba_f64(rgba: RgbaOf<f64>) -> Self; fn from_rgba_float(rgba: RgbaOf<f32>) -> Self;
}
Expand description

Constant color name are based on https://colornames.org/

(+-1 u8 unit per channel, otherwise #FF7F00 should be named Orange Juice and not Orange, because Orange is #FF7F00)

Required Associated Constants§

Source

const TRANSPARENT: Self

Source

const BLACK: Self

#000000

⬛ : ⬛⬛⬛

Source

const GREY: Self

#777777

If you preferer the name Gray, just do :

use hexga_image::prelude::*;
use hexga_math::prelude::*;

pub trait IPreferGray
{
   const GRAY : Self;
}
impl<C> IPreferGray for C where C: IColor
{
   const GRAY : Self = Self::GREY;
}
Source

const WHITE: Self

#FFFFFF

⬜ : 🟥🟩🟦

Source

const RED: Self

#FF0000

🟥 : 🟥⬛⬛

Source

const GREEN: Self

#00FF00

🟩 : ⬛🟩⬛

Source

const BLUE: Self

#0000FF

🟦 : ⬛⬛🟦

Source

const CYAN: Self

#00FFFF

_ : ⬛🟩🟦

Source

const MAGENTA: Self

#FF00FF

_ : 🟥⬛🟦

Source

const YELLOW: Self

#FFFF00

🟨 : 🟥🟩⬛

Source

const SPRING: Self

#00FF7F

Source

const AZURE: Self

#007FFF

Source

const VIOLET: Self

#7F00FF

Source

const ROSE: Self

#FF007F

Source

const ORANGE: Self

#FF7F00

Source

const LIME: Self

#7FFF00

Source

const CANARY: Self

#FFFF7F

Source

const PINK: Self

#FF7FFF

Source

const GLACE: Self

#7FFFFF

Required Associated Types§

Required Methods§

Source

fn to_rgba_of<R>(self) -> RgbaOf<R>
where R: Primitive + CastRangeFrom<Self::Component>,

Source

fn to_hsla_of<R>(self) -> HslaOf<R>
where R: Float + CastRangeFrom<Self::Component>,

Source

fn from_rgba_u8(rgba: RgbaOf<u8>) -> Self

Source

fn from_rgba_u16(rgba: RgbaOf<u16>) -> Self

Source

fn from_rgba_f32(rgba: RgbaOf<f32>) -> Self

Source

fn from_rgba_f64(rgba: RgbaOf<f64>) -> Self

Source

fn from_rgba_float(rgba: RgbaOf<f32>) -> Self

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§