Skip to main content

ColorSpace

Trait ColorSpace 

Source
pub trait ColorSpace:
    Sized
    + Copy
    + Clone
    + PartialEq {
    const MODE: &'static str;
    const CHANNELS: &'static [&'static str];

    // Required methods
    fn alpha(&self) -> Option<f64>;
    fn with_alpha(self, alpha: Option<f64>) -> Self;
    fn to_xyz65(&self) -> Xyz65;
    fn from_xyz65(xyz: Xyz65) -> Self;
}
Expand description

A color space: a fixed set of channels with conversions to and from the XYZ D65 hub.

Required Associated Constants§

Source

const MODE: &'static str

Stable identifier for this space (matches culori’s mode string).

Source

const CHANNELS: &'static [&'static str]

The space’s natural channels in canonical order. Alpha is excluded: it is a universal meta-channel accessed via alpha rather than a channel of any particular space.

Required Methods§

Source

fn alpha(&self) -> Option<f64>

Returns the alpha channel, if set.

Source

fn with_alpha(self, alpha: Option<f64>) -> Self

Returns a copy of self with the given alpha.

Source

fn to_xyz65(&self) -> Xyz65

Convert this color into the XYZ D65 hub space.

Source

fn from_xyz65(xyz: Xyz65) -> Self

Construct a color of this space from the XYZ D65 hub space.

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 ColorSpace for A98

Source§

const MODE: &'static str = "a98"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Cubehelix

Source§

const MODE: &'static str = "cubehelix"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Dlab

Source§

const MODE: &'static str = "dlab"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Dlch

Source§

const MODE: &'static str = "dlch"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Hpluv

Source§

const MODE: &'static str = "hpluv"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Hsi

Source§

const MODE: &'static str = "hsi"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Hsl

Source§

const MODE: &'static str = "hsl"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Hsluv

Source§

const MODE: &'static str = "hsluv"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Hsv

Source§

const MODE: &'static str = "hsv"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Hwb

Source§

const MODE: &'static str = "hwb"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Itp

Source§

const MODE: &'static str = "itp"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Jab

Source§

const MODE: &'static str = "jab"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Jch

Source§

const MODE: &'static str = "jch"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Lab65

Source§

const MODE: &'static str = "lab65"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Lab

Source§

const MODE: &'static str = "lab"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Lch65

Source§

const MODE: &'static str = "lch65"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Lch

Source§

const MODE: &'static str = "lch"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Lchuv

Source§

const MODE: &'static str = "lchuv"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for LinearRgb

Source§

const MODE: &'static str = "lrgb"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Luv

Source§

const MODE: &'static str = "luv"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Okhsl

Source§

const MODE: &'static str = "okhsl"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Okhsv

Source§

const MODE: &'static str = "okhsv"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Oklab

Source§

const MODE: &'static str = "oklab"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Oklch

Source§

const MODE: &'static str = "oklch"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for P3

Source§

const MODE: &'static str = "p3"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Prismatic

Source§

const MODE: &'static str = "prismatic"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for ProphotoRgb

Source§

const MODE: &'static str = "prophoto"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Rec2020

Source§

const MODE: &'static str = "rec2020"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Rgb

Source§

const MODE: &'static str = "rgb"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Xyb

Source§

const MODE: &'static str = "xyb"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Xyz50

Source§

const MODE: &'static str = "xyz50"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Xyz65

Source§

const MODE: &'static str = "xyz65"

Source§

const CHANNELS: &'static [&'static str]

Source§

impl ColorSpace for Yiq

Source§

const MODE: &'static str = "yiq"

Source§

const CHANNELS: &'static [&'static str]