Expand description
Fairly complete css-color implementation. Relative colors, color-mix, system colors, and other such things require better calc() support and integration.
Structs§
- Color
Function - A color specified by the color() function. https://drafts.csswg.org/css-color-4/#color-function
- Default
Color Parser - Default implementation of a
ColorParser
- Hsl
- Color specified by hue, saturation and lightness components.
- Hwb
- Color specified by hue, whiteness and blackness components.
- Lab
- Color specified by lightness, a- and b-axis components.
- Lch
- Color specified by lightness, chroma and hue components.
- Oklab
- Color specified by lightness, a- and b-axis components.
- Oklch
- Color specified by lightness, chroma and hue components.
- Rgba
Legacy - A color with red, green, blue, and alpha components, in a byte each.
Enums§
- Angle
OrNumber - Either an angle or a number.
- Color
- Describes one of the value
values according to the CSS specification. - Number
OrPercentage - Either a number or a percentage.
Traits§
- Color
Parser - A trait that can be used to hook into how
cssparser
parses color components, with the intention of implementing more complicated behavior. - From
Parsed Color - This trait is used by the
ColorParser
to construct colors of any type.
Functions§
- hsl_
to_ rgb - https://drafts.csswg.org/css-color/#hsl-color except with h pre-multiplied by 3, to avoid some rounding errors.
- hwb_
to_ rgb - https://drafts.csswg.org/css-color-4/#hwb-to-rgb
- parse_
color_ keyword - Return the named color with the given name.
- parse_
color_ with - Parse a CSS color using the specified
ColorParser
and return a new color value on success. - parse_
components - Parse the color components and alpha with the modern [color-4] syntax.