Convert Color
GEThttps://api-colors.dataandapis.com/v1/colors/convert
Convert Color is an endpoint of the Colors API. Name, convert and check contrast for any color, with 31,919 curated names and WCAG math.
Send your key in the X-Api-Key header. Each call costs 1 token; a free key includes 500 tokens a month.
Request
Query parameters
| Parameter | Example | |
|---|---|---|
| value | #FF5733 | Required |
Example request
curl
curl "https://api-colors.dataandapis.com/v1/colors/convert?value=%23FF5733" \
-H "X-Api-Key: YOUR_API_KEY"Node.js
const res = await fetch("https://api-colors.dataandapis.com/v1/colors/convert?value=%23FF5733", {
headers: { "X-Api-Key": process.env.DATAANDAPIS_KEY },
});
const data = await res.json();Python
import os, requests
r = requests.get(
"https://api-colors.dataandapis.com/v1/colors/convert?value=%23FF5733",
headers={"X-Api-Key": os.environ["DATAANDAPIS_KEY"]},
)
data = r.json()Example response
Example response{
"ok": true,
"hex": "#ff5733",
"rgb": {
"r": 255,
"g": 87,
"b": 51
},
"hsl": {
"h": 11,
"s": 100,
"l": 60
},
"hsv": {
"h": 11,
"s": 80,
"v": 100
},
"cmyk": {
"c": 0,
"m": 65.88,
"y": 80,
"k": 0
},
"luminance": 0.283,
"is_dark": false,
"name": {
"hex": "#fa5b3d",
…
Show full response
Example response
{
"ok": true,
"hex": "#ff5733",
"rgb": {
"r": 255,
"g": 87,
"b": 51
},
"hsl": {
"h": 11,
"s": 100,
"l": 60
},
"hsv": {
"h": 11,
"s": 80,
"v": 100
},
"cmyk": {
"c": 0,
"m": 65.88,
"y": 80,
"k": 0
},
"luminance": 0.283,
"is_dark": false,
"name": {
"hex": "#fa5b3d",
…{
"ok": true,
"hex": "#ff5733",
"rgb": {
"r": 255,
"g": 87,
"b": 51
},
"hsl": {
"h": 11,
"s": 100,
"l": 60
},
"hsv": {
"h": 11,
"s": 80,
"v": 100
},
"cmyk": {
"c": 0,
"m": 65.88,
"y": 80,
"k": 0
},
"luminance": 0.283,
"is_dark": false,
"name": {
"hex": "#fa5b3d",
"name": "Orange Soda",
"is_bestof": true,
"is_css": false,
"distance": 11.87,
"exact": false
},
"nearest_css": {
"hex": "#ff6347",
"name": "tomato",
"distance": 23.32
}
}
