Convert color
convertTranslate colors between any of 221 color spaces from CSS strings or channel values, including batch input and out-of-range channel flags.
Instructions
Convert a color between any two of the 221 color spaces, identity included, in each space's conventional ranges (rgb 0-255, oklch L 0-1 / C 0-0.4 / H 0-360, lab L 0-100 …). The color goes in as a CSS string (color) or as channel values (from + values); a batch as colors – tuples in from, CSS strings, or both. Out-of-range in, unclamped out: inRange flags each channel against the target's conventional range (rgb below 0 means outside sRGB); null = undefined at that coordinate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | target space id, e.g. 'rgb', 'oklch', 'lab', 'slog3', 'rec709' (the 'spaces' tool lists all 221) | |
| 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)' | |
| colors | No | a batch: one tuple (in `from`) or CSS string per color, e.g. [[255, 128, 0], '#00ff80', 'oklch(0.7 0.1 50)'] | |
| values | No | one color in the source space, e.g. [255, 128, 0] for rgb |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | ||
| from | No | ||
| colors | Yes | ||
| channels | Yes |