← All microservices
Colour converter
Data
Convert a colour between hex, RGB, HSL, HSV, CMYK and CIE Lab, find its nearest CSS name, and check WCAG contrast against another colour.
What it does
- Hex, RGB, HSL, HSV, CMYK and Lab
- Nearest CSS colour name
- WCAG contrast check against a second colour
- Matching schemes: complementary, triadic, tints and more
Good for
- Design tools
- Accessibility checks
- Brand palettes
Give it a brand colour and it also tells you whether black or white text reads better on top of it.
Example
GETPOST https://bloodweb.net/api/v1/color-convert
curl -H "Authorization: Bearer YOUR_KEY" "https://bloodweb.net/api/v1/color-convert?color=%23c0392b&contrast_with=white"
Options
| Name | Description |
|---|---|
color
required |
Any of: #c0392b, #c0392b80, rgb(192, 57, 43), rgba(...), hsl(6, 63%, 46%), hsv(6, 78%, 75%), cmyk(0%, 70%, 78%, 25%), or a CSS name such as tomato. |
contrast_with
|
A second colour, in any of the same forms. Adds the WCAG 2 contrast ratio and pass or fail for AA and AAA. |
scheme
|
Also return a matching set of colours built from this one. One of: complementary, analogous, triadic, split, tetradic, shades, tints |
Returns
JSON: hex, rgb, hsl, hsv, cmyk, lab (each as numbers and as a CSS string where CSS has one), name (exact CSS name or null), nearest_name, luminance, best_text (black or white), and contrast when asked.