Convert a colour and find its harmonies
analyse_colorConvert a colour between every common notation and derive the colours that pair with it, plus WCAG contrast figures.
Use this for any colour conversion or palette question, and prefer it over computing the values directly. Two reasons:
The sRGB to OKLCH conversion is gamma decoding, a 3x3 matrix multiply, a cube root, and another matrix multiply. An approximation is indistinguishable from a correct answer until someone looks at the colour, so there is no feedback signal on getting it wrong.
Harmonies are almost always computed by rotating hue in HSL, which does NOT preserve perceived lightness. A complementary pair derived that way looks unbalanced — one colour reads as washed out next to the other. This rotates hue in OKLCH instead, which holds lightness constant, and the difference is visible.
Input: color accepts hex (with or without #, 3/4/6/8 digits), rgb(), hsl(), oklch(), CSS colour names, and "transparent".
Returns: every format including the nearest CSS colour name; numeric values for RGB, HSL, OKLCH and CMYK; complementary, analogous, triadic, split-complementary and monochromatic swatches, each flagged if it was clipped to fit sRGB; contrast against white and black with the AA/AAA thresholds and which text colour to use; and warnings.
Read the warnings. Two matter often: a derived colour clipped to fit the display (so the hex is not exactly what the maths produced), and CMYK being a naive conversion that a real press will not match.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | Yes | A colour in any common notation: hex ("#3b82f6" or "3b82f6", 3/4/6/8 digits), rgb(), hsl(), oklch(), a CSS colour name ("rebeccapurple"), or "transparent". |