API Almanac
API reference › Color

Parse a color (hex, rgb(), hsl(), CSS name), convert it, name it, and check WCAG contrast against another

GET/v1/color

GET/v1/color

Parse a color (hex, rgb(), hsl(), CSS name), convert it, name it, and check WCAG contrast against another

PARAMETERS
valuequery · stringREQUIRED
The color
e.g. #2F6B4F
comparequery · string
A second color for contrast (e.g. the background)
e.g. #FAF7F0
In the full reference
REQUEST
curl "https://api.apialmanac.com/v1/color?value=%232F6B4F" \
  -H "X-API-Key: YOUR_KEY"
RESPONSE
200OK
{
  "input": "#2F6B4F",
  "hex": "#2f6b4f",
  "hex_alpha": null,
  "rgb": {
    "r": 47,
    "g": 107,
    "b": 79
  },
  "alpha": 1,
  "css": "rgb(47 107 79)",
  "hsl": {
    "h": 152,
    "s": 39,
    "l": 30,
    "css": "hsl(152 39% 30%)"
  },
  "hsv": {
    "h": 152,
    "s": 56,
    "v": 42
  },
  "cmyk": {
    "c": 56,
    "m": 0,
    "y": 26,
    "k": 58
  },
  "luminance": 0.11,
  "is_dark": true,
  "text_on_it": "#ffffff",
  "name": null,
  "nearest_named": {
    "name": "seagreen",
    "hex": "#2e8b57",
    "distance": 19.6,
    "metric": "CIE76 ΔE"
  },
  "complementary": "#6b2f4b",
  "contrast": {
    "with": "#faf7f0",
    "ratio": 5.68,
    "aa_normal_text": true,
    "aa_large_text": true,
    "aaa_normal_text": false,
    "aaa_large_text": true
  }
}
Try it — sign in first
Runs on a sandbox key: 200 requests a month. Your real key is for production.