Enum style::color::ColorSpace
source · #[repr(u8)]pub enum ColorSpace {
Show 14 variants
Srgb = 0,
Hsl = 1,
Hwb = 2,
Lab = 3,
Lch = 4,
Oklab = 5,
Oklch = 6,
SrgbLinear = 7,
DisplayP3 = 8,
A98Rgb = 9,
ProphotoRgb = 10,
Rec2020 = 11,
XyzD50 = 12,
XyzD65 = 13,
}
Expand description
A color space representation in the CSS specification.
https://drafts.csswg.org/css-color-4/#typedef-color-space
Variants§
Srgb = 0
A color specified in the sRGB color space with either the rgb/rgba(..) functions or the newer color(srgb ..) function. If the color(..) function is used, the AS_COLOR_FUNCTION flag will be set. Examples: “color(srgb 0.691 0.139 0.259)”, “rgb(176, 35, 66)”
Hsl = 1
A color specified in the Hsl notation in the sRGB color space, e.g. “hsl(289.18 93.136% 65.531%)” https://drafts.csswg.org/css-color-4/#the-hsl-notation
Hwb = 2
A color specified in the Hwb notation in the sRGB color space, e.g. “hwb(740deg 20% 30%)” https://drafts.csswg.org/css-color-4/#the-hwb-notation
Lab = 3
A color specified in the Lab color format, e.g. “lab(29.2345% 39.3825 20.0664)”. https://w3c.github.io/csswg-drafts/css-color-4/#lab-colors
Lch = 4
A color specified in the Lch color format, e.g. “lch(29.2345% 44.2 27)”. https://w3c.github.io/csswg-drafts/css-color-4/#lch-colors
Oklab = 5
A color specified in the Oklab color format, e.g. “oklab(40.101% 0.1147 0.0453)”. https://w3c.github.io/csswg-drafts/css-color-4/#lab-colors
Oklch = 6
A color specified in the Oklch color format, e.g. “oklch(40.101% 0.12332 21.555)”. https://w3c.github.io/csswg-drafts/css-color-4/#lch-colors
SrgbLinear = 7
A color specified with the color(..) function and the “srgb-linear” color space, e.g. “color(srgb-linear 0.435 0.017 0.055)”.
DisplayP3 = 8
A color specified with the color(..) function and the “display-p3” color space, e.g. “color(display-p3 0.84 0.19 0.72)”.
A98Rgb = 9
A color specified with the color(..) function and the “a98-rgb” color space, e.g. “color(a98-rgb 0.44091 0.49971 0.37408)”.
ProphotoRgb = 10
A color specified with the color(..) function and the “prophoto-rgb” color space, e.g. “color(prophoto-rgb 0.36589 0.41717 0.31333)”.
Rec2020 = 11
A color specified with the color(..) function and the “rec2020” color space, e.g. “color(rec2020 0.42210 0.47580 0.35605)”.
XyzD50 = 12
A color specified with the color(..) function and the “xyz-d50” color space, e.g. “color(xyz-d50 0.2005 0.14089 0.4472)”.
XyzD65 = 13
A color specified with the color(..) function and the “xyz-d65” or “xyz”
color space, e.g. “color(xyz-d65 0.21661 0.14602 0.59452)”.
NOTE: https://drafts.csswg.org/css-color-4/#resolving-color-function-values
specifies that xyz
is an alias for the xyz-d65
color space.
Implementations§
source§impl ColorSpace
impl ColorSpace
sourcepub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>>
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>>
Parse this keyword.
sourcepub fn from_ident(ident: &str) -> Result<Self, ()>
pub fn from_ident(ident: &str) -> Result<Self, ()>
Parse this keyword from a string slice.
source§impl ColorSpace
impl ColorSpace
sourcepub fn is_rectangular(&self) -> bool
pub fn is_rectangular(&self) -> bool
Returns whether this is a <rectangular-color-space>
.
sourcepub fn is_rgb_or_xyz_like(&self) -> bool
pub fn is_rgb_or_xyz_like(&self) -> bool
Returns true if the color has RGB or XYZ components.
Trait Implementations§
source§impl Clone for ColorSpace
impl Clone for ColorSpace
source§fn clone(&self) -> ColorSpace
fn clone(&self) -> ColorSpace
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ColorSpace
impl Debug for ColorSpace
source§impl<'de> Deserialize<'de> for ColorSpace
impl<'de> Deserialize<'de> for ColorSpace
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<PredefinedColorSpace> for ColorSpace
impl From<PredefinedColorSpace> for ColorSpace
source§fn from(value: PredefinedColorSpace) -> Self
fn from(value: PredefinedColorSpace) -> Self
source§impl MallocSizeOf for ColorSpace
impl MallocSizeOf for ColorSpace
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl Parse for ColorSpace
impl Parse for ColorSpace
source§fn parse<'i, 't>(
_: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>>
fn parse<'i, 't>( _: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>
source§impl PartialEq for ColorSpace
impl PartialEq for ColorSpace
source§impl Serialize for ColorSpace
impl Serialize for ColorSpace
source§impl ToAnimatedValue for ColorSpace
impl ToAnimatedValue for ColorSpace
source§type AnimatedValue = ColorSpace
type AnimatedValue = ColorSpace
source§fn from_animated_value(from: Self::AnimatedValue) -> Self
fn from_animated_value(from: Self::AnimatedValue) -> Self
source§fn to_animated_value(self, context: &Context<'_>) -> Self::AnimatedValue
fn to_animated_value(self, context: &Context<'_>) -> Self::AnimatedValue
source§impl ToComputedValue for ColorSpace
impl ToComputedValue for ColorSpace
source§type ComputedValue = ColorSpace
type ComputedValue = ColorSpace
source§fn from_computed_value(from: &Self::ComputedValue) -> Self
fn from_computed_value(from: &Self::ComputedValue) -> Self
source§fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
Context
.source§impl ToCss for ColorSpace
impl ToCss for ColorSpace
source§impl ToResolvedValue for ColorSpace
impl ToResolvedValue for ColorSpace
source§type ResolvedValue = ColorSpace
type ResolvedValue = ColorSpace
source§fn from_resolved_value(from: Self::ResolvedValue) -> Self
fn from_resolved_value(from: Self::ResolvedValue) -> Self
source§fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
source§impl ToShmem for ColorSpace
impl ToShmem for ColorSpace
impl Copy for ColorSpace
impl Eq for ColorSpace
impl StructuralPartialEq for ColorSpace
Auto Trait Implementations§
impl Freeze for ColorSpace
impl RefUnwindSafe for ColorSpace
impl Send for ColorSpace
impl Sync for ColorSpace
impl Unpin for ColorSpace
impl UnwindSafe for ColorSpace
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more