Trait lightningcss::values::color::ColorSpace

source ·
pub trait ColorSpace {
    // Required methods
    fn components(&self) -> (f32, f32, f32, f32);
    fn channels(&self) -> (&'static str, &'static str, &'static str);
    fn types(&self) -> (ChannelType, ChannelType, ChannelType);
    fn resolve_missing(&self) -> Self;
    fn resolve(&self) -> Self;
}
Expand description

A trait for color spaces.

Required Methods§

source

fn components(&self) -> (f32, f32, f32, f32)

Returns the raw color component values.

source

fn channels(&self) -> (&'static str, &'static str, &'static str)

Returns the channel names for this color space.

source

fn types(&self) -> (ChannelType, ChannelType, ChannelType)

Returns the channel types for this color space.

source

fn resolve_missing(&self) -> Self

Resolves missing color components (e.g. none keywords) in the color.

source

fn resolve(&self) -> Self

Returns a resolved color by replacing missing (i.e. none) components with zero, and performing gamut mapping to ensure the color can be represented within the color space.

Object Safety§

This trait is not object safe.

Implementors§