Say Hello to the Converting Colors REST API

Andreas Zettl | 3 minute read

For a long time, I already offered the possibility to download the conversions and harmonies via a JSON and XML URL. The Main Problem with this was that the URLs were not really developer-friendly.

So now, I replaced these old links with a REST API, which delivers you the same result.



Using the REST API

To use the REST API, just call convertingcolors.com/rest/convert/FORMAT/VALUE with your source format and value. The value is actually depending on your color format. For Hex, Android, and Decimal, the value is a single string, but for the other formats, it is one value per Directory Level. So as an example with the source format RGB, it would be convertingcolors.com/rest/convert/FORMAT/R/G/B.

The REST URLs mentioned above will return you a JSON string if you prefer XML then add the output format to the URL: convertingcolors.com/rest/convert/xml/FORMAT/VALUE.

Samples

https://convertingcolors.com/rest/convert/rgb/238/227/176 will give you the following output:

{
  "conversions": {
    "Hex": "EEE3B0",
    "RGB": "238, 227, 176",
    "RGBPercent": "93%, 89%, 69%",
    "CMYK": "0.00, 0.05, 0.26, 0.07",
    "CMY": "0.0667, 0.1098, 0.3098",
    "HSV": "49°, 26%, 93%",
    "HSL": "49°, 65%, 81%",
    "CIELab": "89.98, -4.04, 26.31",
    "CIELCh": "90, 26.621, 98.737",
    "XYZ": "70.5655, 76.2499, 52.0728",
    "Yxy": "76.2499, 0.3548, 0.3834",
    "RYB": "189, 238, 176",
    "Android": "4293845936",
    "Decimal": "15655856",
    "YUV": "224.4750, -23.8982, 11.8614"
  },
  "description": "",
  "harmonies": {
    "Analogous": ["FFDBB4","EEE3B0","D1EABA"],
    "Triad": ["EEE3B0","9CEFFF","FFD2F5"],
    "Complementary": ["EEE3B0","B0BBEE"],
    "Split Complementary": ["F0D9FF","EEE3B0","AEEAFF"],
    "Square": ["EEE3B0","A0F1E9","CEE2FF","FFD0DC"],
    "Rectangle": ["EEE3B0","BEEEC7","CEE2FF","FFD4FD"],
    "Sweetspot": ["EEE3B0","FFFBEB","EEB0BB","807D73","000000","808080"]
  }
}

For XML check out yourself under https://convertingcolors.com/rest/convert/xml/hex/EEE3B0.

Learn to Code with this Udacity Course: Introduction to ProgrammingAdvertisment🛈

🔙 Back to the article overview | Share on Twitter