use case

How to convert colours programmatically via the REST API

Use the Color Converter API to convert HEX or RGB colours in a script or application.

Design systems, style guide generators, and image-processing pipelines often need to convert colours at runtime — converting a brand HEX to HSL for a CSS variable, or normalising colours from different sources to a single format. The quickhelp.dev Color Converter REST API handles all four formats in a single request with no dependencies. This guide shows how to call it from JavaScript, Python, and curl.

Step-by-step guide

  1. Call the API with a colour in any format: POST to https://quickhelp.dev/api/color-converter with { "color": "#ff6600" }. The response includes all four formats simultaneously.
  2. Extract the format you need: Read response.hex for HEX, response.rgb.css for the CSS rgb() string, response.hsl.css for the CSS hsl() string, or individual channel values from response.hsl.h, response.hsl.s, response.hsl.l.
  3. Example in JavaScript: const res = await fetch('https://quickhelp.dev/api/color-converter', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ color: '#ff6600' }) }); const { hsl } = await res.json(); console.log(hsl.css); // hsl(24, 100%, 50%)

Frequently asked questions

Is there a rate limit on the Color Converter API?
Anonymous API calls are limited to 30 requests per minute per IP. For higher throughput, contact quickhelp.dev for an API key. All conversions are stateless and deterministic — the same input always returns the same output.
Can I batch-convert many colours in one request?
The current API accepts one colour per request. For bulk conversion, send requests in parallel. In Node.js: const results = await Promise.all(colors.map(c => fetch('/api/color-converter', {method:'POST', body: JSON.stringify({color:c})}).then(r=>r.json())));

Try it now

Use the Color Converter to complete this task — free, no sign-up, runs in your browser.

Open Color Converter

We use cookies to serve ads and measure traffic. Cookie policy · Privacy policy