Type Alias style::values::computed::color::Color

source ·
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

source

pub const TRANSPARENT: Self = _

A fully transparent color.

source

pub const BLACK: Self = _

An opaque black color.

source

pub const WHITE: Self = _

An opaque white color.

source

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.

source

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>

source

pub fn as_absolute(&self) -> Option<&AbsoluteColor>

If this color is absolute return it’s value, otherwise return None.

source

pub fn currentcolor() -> Self

Returns a color value representing currentcolor.

source

pub fn is_currentcolor(&self) -> bool

Whether it is a currentcolor value (no numeric color component).

source

pub fn is_absolute(&self) -> bool

Whether this color is an absolute color.

Trait Implementations§

source§

impl<Percentage: Clone> Clone for GenericColor<Percentage>

source§

fn clone(&self) -> GenericColor<Percentage>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Percentage: Debug> Debug for GenericColor<Percentage>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Percentage> MallocSizeOf for GenericColor<Percentage>where Percentage: MallocSizeOf,

source§

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>

source§

fn eq(&self, other: &GenericColor<Percentage>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Percentage> ToAnimatedValue for GenericColor<Percentage>where Percentage: ToAnimatedValue,

§

type AnimatedValue = GenericColor<<Percentage as ToAnimatedValue>::AnimatedValue>

The type of the animated value.
source§

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

Converts this value to an animated value.
source§

impl ToCss for Color

source§

fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere W: Write,

Serialize self in CSS syntax, writing to dest.
source§

fn to_css_string(&self) -> String

Serialize self in CSS syntax and return a string. Read more
source§

impl ToResolvedValue for Color

§

type ResolvedValue = AbsoluteColor

The resolved value type we’re going to be converted to.
source§

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

Convert a resolved value to resolved value form.
source§

impl<Percentage> ToShmem for GenericColor<Percentage>where Percentage: ToShmem,

source§

fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self>

Clones this value into a form suitable for writing into a SharedMemoryBuilder. Read more
source§

impl<Percentage> StructuralPartialEq for GenericColor<Percentage>