Type Definition style::values::computed::color::Color

source ·
pub type Color = GenericColor<Percentage>;
Expand description

A computed value for <color>.

Implementations§

source§

impl 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 transparent() -> Color

Returns a complex color value representing transparent.

source

pub fn black() -> Color

Returns opaque black.

source

pub fn white() -> Color

Returns opaque white.

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>) -> 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.