pub type Color = GenericColor<Percentage>;
Expand description
A computed value for <color>
.
Aliased Type§
enum Color {
Absolute(AbsoluteColor),
CurrentColor,
ColorMix(Box<GenericColorMix<GenericColor<Percentage>, Percentage>, Global>),
}
Variants§
Absolute(AbsoluteColor)
The actual numeric color.
CurrentColor
The CurrentColor
keyword.
ColorMix(Box<GenericColorMix<GenericColor<Percentage>, Percentage>, Global>)
The color-mix() function.
Implementations§
source§impl Color
impl Color
sourcepub const TRANSPARENT: Self = _
pub const TRANSPARENT: Self = _
A fully transparent color.
sourcepub fn from_color_mix(color_mix: ColorMix) -> Self
pub fn from_color_mix(color_mix: ColorMix) -> Self
Create a new computed Color
from a given color-mix, simplifying it to an absolute color
if possible.
sourcepub fn resolve_to_absolute(
&self,
current_color: &AbsoluteColor
) -> AbsoluteColor
pub fn resolve_to_absolute( &self, current_color: &AbsoluteColor ) -> AbsoluteColor
Combine this complex color with the given foreground color into an absolute color.
source§impl<Percentage> Color<Percentage>
impl<Percentage> Color<Percentage>
sourcepub fn as_absolute(&self) -> Option<&AbsoluteColor>
pub fn as_absolute(&self) -> Option<&AbsoluteColor>
If this color is absolute return it’s value, otherwise return None.
sourcepub fn currentcolor() -> Self
pub fn currentcolor() -> Self
Returns a color value representing currentcolor.
sourcepub fn is_currentcolor(&self) -> bool
pub fn is_currentcolor(&self) -> bool
Whether it is a currentcolor value (no numeric color component).
sourcepub fn is_absolute(&self) -> bool
pub fn is_absolute(&self) -> bool
Whether this color is an absolute color.
Trait Implementations§
source§impl<Percentage: Clone> Clone for GenericColor<Percentage>
impl<Percentage: Clone> Clone for GenericColor<Percentage>
source§fn clone(&self) -> GenericColor<Percentage>
fn clone(&self) -> GenericColor<Percentage>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Percentage: Debug> Debug for GenericColor<Percentage>
impl<Percentage: Debug> Debug for GenericColor<Percentage>
source§impl<Percentage> MallocSizeOf for GenericColor<Percentage>where
Percentage: MallocSizeOf,
impl<Percentage> MallocSizeOf for GenericColor<Percentage>where Percentage: MallocSizeOf,
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl<Percentage: PartialEq> PartialEq<GenericColor<Percentage>> for GenericColor<Percentage>
impl<Percentage: PartialEq> PartialEq<GenericColor<Percentage>> for GenericColor<Percentage>
source§fn eq(&self, other: &GenericColor<Percentage>) -> bool
fn eq(&self, other: &GenericColor<Percentage>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<Percentage> ToAnimatedValue for GenericColor<Percentage>where
Percentage: ToAnimatedValue,
impl<Percentage> ToAnimatedValue for GenericColor<Percentage>where Percentage: ToAnimatedValue,
§type AnimatedValue = GenericColor<<Percentage as ToAnimatedValue>::AnimatedValue>
type AnimatedValue = GenericColor<<Percentage as ToAnimatedValue>::AnimatedValue>
The type of the animated value.
source§fn from_animated_value(from: Self::AnimatedValue) -> Self
fn from_animated_value(from: Self::AnimatedValue) -> Self
Converts back an animated value into a computed value.
source§fn to_animated_value(self) -> Self::AnimatedValue
fn to_animated_value(self) -> Self::AnimatedValue
Converts this value to an animated value.
source§impl ToResolvedValue for Color
impl ToResolvedValue for Color
§type ResolvedValue = AbsoluteColor
type ResolvedValue = AbsoluteColor
The resolved value type we’re going to be converted to.
source§fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
Convert a resolved value to a resolved value.
source§fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
Convert a resolved value to resolved value form.