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 colore.g. #2F6B4F
- comparequery · string
- A second color for contrast (e.g. the background)e.g. #FAF7F0
REQUEST
curl "https://api.apialmanac.com/v1/color?value=%232F6B4F" \ -H "X-API-Key: YOUR_KEY"
import requests
r = requests.get("https://api.apialmanac.com/v1/color?value=%232F6B4F", headers={"X-API-Key": "YOUR_KEY"})
print(r.status_code, r.headers.get("X-Gw-Remaining"))
print(r.json())
const r = await fetch("https://api.apialmanac.com/v1/color?value=%232F6B4F", {
headers: { "X-API-Key": "YOUR_KEY" }
});
console.log(r.status, r.headers.get("X-Gw-Remaining"));
console.log(await r.json());
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
}
}