The Color API
www.thecolorapi.com · Developer Tools
Pass a color value and get color information back — RGB, HSL, CMYK, hex, name, and contrasting colors. Supports HEX, RGB, HSL, CMYK input formats. Free, no API key.
Authentication
No authentication requiredFree to use with no key needed.
Sample Requests
GET
Get color info
Get full info for a hex color including name, RGB, HSL, and CMYK.
https://www.thecolorapi.com/id?hex=FF5733
Hover any highlighted part to learn what it does
curl -X GET "https://www.thecolorapi.com/id?hex=FF5733"
import requests
params = {
"hex": "FF5733"
}
response = requests.get(
"https://www.thecolorapi.com/id",
params=params,
)
print(response.json())const url = new URL('https://www.thecolorapi.com/id');
url.searchParams.set('hex', 'FF5733');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www.thecolorapi.com/id")
q := baseURL.Query()
q.Set("hex", "FF5733")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.thecolorapi.com/id")
uri.query = URI.encode_www_form({
"hex" => "FF5733"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.thecolorapi.com/id?" . http_build_query([
"hex" => "FF5733"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Get color scheme
Generate an analogic color scheme from a base color.
https://www.thecolorapi.com/scheme?hex=3498DB&mode=analogic&count=5
Hover any highlighted part to learn what it does
curl -X GET "https://www.thecolorapi.com/scheme?hex=3498DB&mode=analogic&count=5"
import requests
params = {
"hex": "3498DB",
"mode": "analogic",
"count": "5"
}
response = requests.get(
"https://www.thecolorapi.com/scheme",
params=params,
)
print(response.json())const url = new URL('https://www.thecolorapi.com/scheme');
url.searchParams.set('hex', '3498DB');
url.searchParams.set('mode', 'analogic');
url.searchParams.set('count', '5');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www.thecolorapi.com/scheme")
q := baseURL.Query()
q.Set("hex", "3498DB")
q.Set("mode", "analogic")
q.Set("count", "5")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.thecolorapi.com/scheme")
uri.query = URI.encode_www_form({
"hex" => "3498DB",
"mode" => "analogic",
"count" => "5"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.thecolorapi.com/scheme?" . http_build_query([
"hex" => "3498DB",
"mode" => "analogic",
"count" => "5"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key needed
- GET https://www.thecolorapi.com/id?hex=FF0000 for red
- Input formats: ?hex=FF0000, ?rgb=255,0,0, ?hsl=0,100,50, ?cmyk=0,100,100,0
- Color scheme: GET /scheme?hex=COLOR&mode=analogic|complement|triad|quad|quad-plus&count=5
- Random: GET /random