Skip to content
ToolsOnDuty - free online tools
ToolsOnDuty / docs
Browse documentation

Reference / Color

Color API

4 endpoints for color workflows. Every call requires bearer authentication and uses the standard ToolsOnDuty response envelope.

Try it

Runs a real request from your browser to your own ToolsOnDuty account. Your key is only kept in this page and is never stored.

POST/v1/color/similarity1 credit / call

Color similarity

Compare two RGB hex colors using normalized Euclidean distance.

ParameterTypeRequiredDescription
firststringYesFirst 3- or 6-digit hex color.
secondstringYesSecond 3- or 6-digit hex color.

Request

curl -X POST https://toolsonduty.com/api/v1/color/similarity \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"first":"#ffffff","second":"#000000"}'

Response

{
  "ok": true,
  "data": {
    "distance": 441.673,
    "similarity": 0,
    "exactMatch": false
  }
}
POST/v1/color/brightness1 credit / call

Color brightness calculator

Calculate perceived brightness, WCAG relative luminance and recommended text color.

ParameterTypeRequiredDescription
colorstringYesThree- or six-digit hex color.

Request

curl -X POST https://toolsonduty.com/api/v1/color/brightness \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"color":"#2563eb"}'

Response

{
  "ok": true,
  "data": {
    "classification": "dark",
    "recommendedText": "#ffffff"
  }
}
POST/v1/color/name1 credit / call

Color name finder

Find the nearest built-in CSS color name using RGB Euclidean distance.

ParameterTypeRequiredDescription
colorstringYesThree- or six-digit hex color.

Request

curl -X POST https://toolsonduty.com/api/v1/color/name \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"color":"#ff0000"}'

Response

{
  "ok": true,
  "data": {
    "exact": true,
    "nearest": {
      "name": "red",
      "hex": "#ff0000",
      "distance": 0
    }
  }
}
POST/v1/convert/text-color1 credit / call

Text to color

Map text deterministically to a stable HSL and hexadecimal color.

ParameterTypeRequiredDescription
textstringYesText used to derive the color.

Request

curl -X POST https://toolsonduty.com/api/v1/convert/text-color \
  -H "Authorization: ******" \
  -H "Content-Type: application/json" \
  -d '{"text":"ToolsOnDuty"}'

Response

{
  "ok": true,
  "data": {
    "hex": "#336699"
  }
}