BloodwebMicroservices Sign in
← 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.

Want to see the job done first? Try the free Color Converter in your browser, no account needed.

Create an account

It comes with 10,000 free tokens a month.

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.

Try it now

No account needed. Up to 10 runs a day here, files up to 2MB, and nothing is kept.

More options

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"

Complete, tested code for this call: curl · Node.js · Python · PHP

Options

NameDescription
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.

Good to know