Convert colors
colors_convertConverts color values between formats like hex, RGB, HSL, OKLCH, Lab, P3, and Rec.2020, handling lists and out-of-gamut mapping.
Instructions
Convert colors to another format: hex, rgb, hsl, hwb, hsv, oklch, oklab, CSS lab/lch (D50), lab-d65/lch-d65 (CIELAB, D65, no adaptation), xyz (D65), linear (linear sRGB), p3, rec2020 (CSS, 2.4 gamma), rec2020-oetf (BT.2020 transfer) or rec2020-linear. Reads any of them as input. Handles lists. A color outside sRGB (for hex/rgb/hsl/hwb) is mapped in by lowering chroma only, and the result says so.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"colors": "<colors>",
"to": "<to>"
},
"name": "colors_convert"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Target format. "lab"/"lch" are the CSS ones (D50); "lab-d65"/"lch-d65" use the D65 white, no adaptation. "xyz" is D65, "linear" is linear sRGB, "p3" is display-p3, "rec2020" has a 2.4 gamma, "rec2020-oetf" the BT.2020 curve. | |
| colors | Yes | Colors to convert. A list, even for a single color. Any CSS color strings. | |
| precision | No | Decimal places. Default 3. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | ||
| results | Yes |