Skip to main content

Module color

Module color 

Source
Expand description

General color-parsing utilities, independent on the specific color storage and parsing implementation.

For a more complete css-color implementation take a look at cssparser-color crate, or at Geckoโ€™s color module.

Structsยง

named_colors ๐Ÿ”’

Enumsยง

PredefinedColorSpace
A Predefined color space specified in: https://drafts.csswg.org/css-color-4/#predefined

Constantsยง

MAX_LENGTH ๐Ÿ”’
OPAQUE
The opaque alpha value of 1.0.

Staticsยง

__MAP ๐Ÿ”’

Functionsยง

all_named_colors
Returns an iterator over all named CSS colors. https://drafts.csswg.org/css-color-4/#typedef-named-color
clamp_floor_256_f32
Round and clamp a single number to a u8.
clamp_unit_f32
Clamp a 0..1 number to a 0..255 range to u8.
const_usize_max ๐Ÿ”’
from_hex ๐Ÿ”’
parse_hash_color
Parse a color hash, without the leading โ€˜#โ€™ character.
parse_named_color
Returns the named color with the given name. https://drafts.csswg.org/css-color-4/#typedef-named-color
serialize_color_alpha
Serialize the alpha copmonent of a color according to the specification. https://drafts.csswg.org/css-color-4/#serializing-alpha-values