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>>),
}

Variants§

§

Absolute(AbsoluteColor)

The actual numeric color.

§

CurrentColor

The CurrentColor keyword.

§

ColorMix(Box<GenericColorMix<GenericColor<Percentage>, Percentage>>)

The color-mix() function.

Implementations§

source§

impl Color

source

pub const TRANSPARENT_BLACK: 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.

Trait Implementations§

source§

impl ToCss for Color

source§

fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Result
where 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.