Library code
codeGenerate paste-ready color conversion snippets for JavaScript and Python, with verified results and caveats for each source-to-target space pair.
Instructions
The conversion as code to paste: the color-space JS call with its result and – where one exists for the space on the non-sRGB side – the colour-science (Python) equivalent verified against color-space (sRGB ↔ that space), with any named caveat. The color goes in as a CSS string or as values in from (default: sRGB 200, 100, 50).
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)' | |
| values | No | the color in the source space |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| js | Yes | ||
| python | Yes | ||
| pythonFor | Yes |