How to convert colors in code
Convert any color between HEX, RGB, HSL, HSV, CMYK and OKLCH. Examples in curl, JavaScript, and Python.
curl
curl "https://color.wrapper-agency.com/api/v1/color?value=%231A73E8"JavaScript (fetch)
const res = await fetch(
"https://color.wrapper-agency.com/api/v1/color?value=" + encodeURIComponent("#1A73E8")
);
const data = await res.json();
console.log(data.cmyk); // { c: 88.8, m: 50.4, y: 0, k: 9 }
console.log(data.oklch); // { l: 0.5944, c: 0.1817, h: 257.5 }Python (requests)
import requests
r = requests.get(
"https://color.wrapper-agency.com/api/v1/color",
params={"value": "#1A73E8"},
)
d = r.json()
print(d["rgb"]) # {'r': 26, 'g': 115, 'b': 232}
print(d["nearestNamedColor"]) # {'name': 'dodgerblue', ...}Batch conversion (paid)
To convert many colors at once — e.g. a whole palette — POST an array to the paid endpoint. Access is settled per call via x402 (USDC on Base).
curl -X POST "https://color.wrapper-agency.com/api/v1/pro/color" \
-H "Content-Type: application/json" \
-d '{"colors": ["#1A73E8", "rgb(255,0,0)", "teal"]}'A note on CMYK and Pantone
CMYK here is a standard device conversion from sRGB and is great for a quick reference, but exact print output depends on your color profile and press. The Pantone result is the closest entry in an approximation set, labeled closest match — always confirm against an official Pantone guide for production.
See the full API reference. Conversions are computed locally with standard color-space math.