Jetons.CSS.Color (jetons v0.2.2)

Copy Markdown View Source

Serializes DTCG 2025.10 color value maps to CSS color strings.

Supports all 14 color spaces defined in the Color Module specification.

Summary

Functions

Serializes a color value map to a CSS color string.

Functions

serialize(color)

Serializes a color value map to a CSS color string.

Examples

iex> Jetons.CSS.Color.serialize(%{"colorSpace" => "srgb", "components" => [1, 0, 0]})
"color(srgb 1 0 0)"

iex> Jetons.CSS.Color.serialize(%{"colorSpace" => "hsl", "components" => [330, 100, 50], "alpha" => 0.5})
"hsl(330 100% 50% / 0.5)"