
Colour Converter API
Design
Convert between colour formats (HEX, RGB, HSL, CMYK) with a colour picker and text contrast detection.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
100 requests per minute
Endpoints
1 endpoint available
Overview
The Colour Converter API converts colours between multiple formats. Input any colour format and receive all formats in the response - HEX, RGB, RGBA, HSL, HSLA, CMYK, Display P3, and LCH.
Supported Input Formats
- HEX - #FF5733, #f53, FF5733 (with or without #)
- RGB - rgb(255, 87, 51)
- RGBA - rgba(255, 87, 51, 0.8)
- HSL - hsl(9, 100%, 60%)
- HSLA - hsla(9, 100%, 60%, 0.8)
- Named Colors - red, blue, tomato, coral, etc.
Output Formats
Every response includes all of these formats:
- hex - HEX format (#FF5733)
- rgb - RGB format
- rgba - RGBA format with alpha
- hsl - HSL format
- hsla - HSLA format with alpha
- cmyk - CMYK format for print
- displayP3 - Display P3 wide gamut format
- lch - LCH perceptually uniform format
- name - Colour name if recognized
- bestTextColor - Recommended text color (black or white) for contrast
Use Cases
- CSS colour format conversion
- Design system colour management
- Accessibility contrast checking
- Print-ready CMYK conversion
Endpoints
POST
/v1/tools/colour-converterConvert a colour to all supported formats
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| colour | string | Required | The colour to convert (any supported format) |
Response Example
{
"success": true,
"result": {
"hex": "#FF5733",
"rgb": "rgb(255, 87, 51)",
"rgba": "rgba(255, 87, 51, 1)",
"hsl": "hsl(11, 100%, 60%)",
"hsla": "hsla(11, 100%, 60%, 1)",
"cmyk": "cmyk(0, 66, 80, 0)",
"displayP3": "color(display-p3 0.92 0.39 0.25)",
"lch": "lch(57.58 75.55 40.85)",
"name": "Orange Red",
"bestTextColor": "white"
}
}Error Codes
400
Invalid request body or missing colour401
Missing or invalid API key422
Invalid colour format429
Rate limit exceeded500
Internal server errorCode Examples
# Convert HEX to all formats
curl -X POST https://api.opentools.ca/v1/tools/colour-converter \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"colour": "#FF5733"}'
# Convert named colour
curl -X POST https://api.opentools.ca/v1/tools/colour-converter \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"colour": "coral"}'