pub type ColorPropertyValue = AbsoluteColor;
Expand description
The computed value of the color
property.
Aliased Type§
struct ColorPropertyValue {
pub components: ColorComponents,
pub alpha: f32,
pub color_space: ColorSpace,
pub flags: ColorFlags,
}
Fields§
§components: ColorComponents
The 3 components that make up colors in any color space.
alpha: f32
The alpha component of the color.
color_space: ColorSpace
The current color space that the components represent.
flags: ColorFlags
Extra flags used durring serialization of this color.
Implementations§
source§impl AbsoluteColor
impl AbsoluteColor
Write a string to dest
that represents a color as an author would
enter it.
NOTE: The format of the output is NOT according to any specification,
but makes assumptions about the best ways that authors would want to
enter color values in style sheets, devtools, etc.
source§impl AbsoluteColor
impl AbsoluteColor
sourcepub const TRANSPARENT_BLACK: Self = _
pub const TRANSPARENT_BLACK: Self = _
A fully transparent color in the legacy syntax.
sourcepub fn new(
color_space: ColorSpace,
c1: impl Into<ComponentDetails>,
c2: impl Into<ComponentDetails>,
c3: impl Into<ComponentDetails>,
alpha: impl Into<ComponentDetails>
) -> Self
pub fn new( color_space: ColorSpace, c1: impl Into<ComponentDetails>, c2: impl Into<ComponentDetails>, c3: impl Into<ComponentDetails>, alpha: impl Into<ComponentDetails> ) -> Self
Create a new AbsoluteColor
with the given ColorSpace
and
components.
sourcepub fn into_srgb_legacy(self) -> Self
pub fn into_srgb_legacy(self) -> Self
Convert this color into the sRGB color space and set it to the legacy syntax.
sourcepub fn srgb_legacy(red: u8, green: u8, blue: u8, alpha: f32) -> Self
pub fn srgb_legacy(red: u8, green: u8, blue: u8, alpha: f32) -> Self
Create a new AbsoluteColor
from rgba legacy syntax values in the sRGB color space.
sourcepub fn raw_components(&self) -> &[f32; 4]
pub fn raw_components(&self) -> &[f32; 4]
Return all the components of the color in an array. (Includes alpha)
sourcepub fn is_legacy_syntax(&self) -> bool
pub fn is_legacy_syntax(&self) -> bool
Returns true if this color is in the legacy color syntax.
sourcepub fn is_transparent(&self) -> bool
pub fn is_transparent(&self) -> bool
Returns true if this color is fully transparent.
sourcepub fn get_component_by_channel_keyword(
&self,
name: &str
) -> Result<Option<f32>, ()>
pub fn get_component_by_channel_keyword( &self, name: &str ) -> Result<Option<f32>, ()>
Return the value of a component by its channel keyword.
sourcepub fn to_color_space(&self, color_space: ColorSpace) -> Self
pub fn to_color_space(&self, color_space: ColorSpace) -> Self
Convert this color to the specified color space.
Trait Implementations§
source§impl Animate for AbsoluteColor
impl Animate for AbsoluteColor
source§impl Clone for AbsoluteColor
impl Clone for AbsoluteColor
source§fn clone(&self) -> AbsoluteColor
fn clone(&self) -> AbsoluteColor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ComputeSquaredDistance for AbsoluteColor
impl ComputeSquaredDistance for AbsoluteColor
source§fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
source§impl Debug for AbsoluteColor
impl Debug for AbsoluteColor
source§impl<'de> Deserialize<'de> for AbsoluteColor
impl<'de> Deserialize<'de> for AbsoluteColor
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 MallocSizeOf for AbsoluteColor
impl MallocSizeOf for AbsoluteColor
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl PartialEq<AbsoluteColor> for AbsoluteColor
impl PartialEq<AbsoluteColor> for AbsoluteColor
source§fn eq(&self, other: &AbsoluteColor) -> bool
fn eq(&self, other: &AbsoluteColor) -> bool
self
and other
values to be equal, and is used
by ==
.