CSS color strings
cssConvert any color space or string into web color strings like rgb(), oklch(), lab(), and hex, preserving out-of-gamut values.
Instructions
A color as CSS Color 4 strings — rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch() and color(display-p3 | a98-rgb | prophoto-rgb | rec2020 | srgb-linear | xyz-d65 | xyz-d50) — plus #hex inside sRGB. Converted, never gamut-mapped: a string is null where CSS would clamp it into a different color (rgb/hsl/hwb outside sRGB, lightness out of range). gamut is the smallest display gamut that holds the color.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | No | source space id, e.g. 'rgb', 'oklch', 'lab', 'slog3', 'rec709' (the 'spaces' tool lists all 221) | |
| color | No | a CSS color instead of `from` + `values`: '#ff8000', 'rebeccapurple', 'oklch(0.7 0.1 50)', 'lab(54% 80 67)', 'color(display-p3 1 0.5 0)' | |
| values | No | one color in the source space | |
| notations | No | only these, by library space id (default: all) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| css | Yes | ||
| hex | Yes | ||
| gamut | Yes |