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.
Modules§
Structs§
Enums§
- Predefined
Color Space - A Predefined color space specified in: https://drafts.csswg.org/css-color-4/#predefined
Constants§
- 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.
- 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