Struct style::values::computed::color::Color
[−]
[src]
pub struct Color { pub color: RGBA, pub foreground_ratio: u8, }
This struct represents a combined color from a numeric color and the current foreground color (currentcolor keyword). Conceptually, the formula is "color * (1 - p) + currentcolor * p" where p is foreground_ratio.
Fields
color: RGBA
RGBA color.
foreground_ratio: u8
The ratio of currentcolor in complex color.
Methods
impl Color
[src]
pub fn rgba(rgba: RGBA) -> Color
[src]
Returns a numeric color representing the given RGBA value.
pub fn transparent() -> Color
[src]
Returns a complex color value representing transparent.
pub fn currentcolor() -> Color
[src]
Returns a complex color value representing currentcolor.
pub fn is_numeric(&self) -> bool
[src]
Whether it is a numeric color (no currentcolor component).
pub fn is_currentcolor(&self) -> bool
[src]
Whether it is a currentcolor value (no numeric color component).
pub fn to_rgba(&self, fg_color: RGBA) -> RGBA
[src]
Combine this complex color with the given foreground color into a numeric RGBA color. It currently uses linear blending.
Trait Implementations
impl Clone for Color
[src]
fn clone(&self) -> Color
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Color
[src]
impl Debug for Color
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl MallocSizeOf for Color
[src]
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
[src]
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more
impl PartialEq for Color
[src]
fn eq(&self, other: &Color) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl From<RGBA> for Color
[src]
impl ToCss for Color
[src]
fn to_css<W>(&self, dest: &mut W) -> Result where
W: Write,
[src]
W: Write,
Serialize self
in CSS syntax, writing to dest
.
fn to_css_string(&self) -> String
[src]
Serialize self
in CSS syntax and return a string. Read more
impl ToAnimatedValue for Color
[src]
type AnimatedValue = AnimatedColor
The type of the animated value.
fn to_animated_value(self) -> Self::AnimatedValue
[src]
Converts this value to an animated value.
fn from_animated_value(animated: Self::AnimatedValue) -> Self
[src]
Converts back an animated value into a computed value.