#[repr(C)]pub enum GenericColor<Percentage> {
Absolute(AbsoluteColor),
CurrentColor,
ColorMix(Box<GenericColorMix<Self, Percentage>>),
}
Expand description
This struct represents a combined color from a numeric color and the current foreground color (currentcolor keyword).
Variants§
Absolute(AbsoluteColor)
The actual numeric color.
CurrentColor
The CurrentColor
keyword.
ColorMix(Box<GenericColorMix<Self, Percentage>>)
The color-mix() function.
Implementations§
source§impl GenericColor<Percentage>
impl GenericColor<Percentage>
sourcepub const TRANSPARENT_BLACK: Self = _
pub const TRANSPARENT_BLACK: 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 for GenericColor<Percentage>
impl<Percentage: PartialEq> PartialEq 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, context: &Context<'_>) -> Self::AnimatedValue
fn to_animated_value(self, context: &Context<'_>) -> Self::AnimatedValue
Converts this value to an animated value.
source§impl<Percentage> ToShmem for GenericColor<Percentage>where
Percentage: ToShmem,
impl<Percentage> ToShmem for GenericColor<Percentage>where
Percentage: ToShmem,
impl<Percentage> StructuralPartialEq for GenericColor<Percentage>
Auto Trait Implementations§
impl<Percentage> Freeze for GenericColor<Percentage>
impl<Percentage> RefUnwindSafe for GenericColor<Percentage>where
Percentage: RefUnwindSafe,
impl<Percentage> Send for GenericColor<Percentage>where
Percentage: Send,
impl<Percentage> Sync for GenericColor<Percentage>where
Percentage: Sync,
impl<Percentage> Unpin for GenericColor<Percentage>
impl<Percentage> UnwindSafe for GenericColor<Percentage>where
Percentage: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert