xtract.bot
POST /api/color-convert

Parse a colour in any common notation (hex, rgb, hsl, hsv, CSS-named) and emit it in every other form. Reports brightness and dark/light flags for accessible-contrast decisions.

Parses a colour string in any common notation: - Hex: `#fff`, `#ffffff`, `#ffffffff` (with alpha). - Functional: `rgb`, `rgba`, `hsl`, `hsla`, `hsv`, `hsva`. - CSS-named: `tomato`, `rebeccapurple`, etc. Emits the same colour in every other form, plus perceived brightness (0–255) and `isDark` / `isLight` flags so you can pick a contrasting text colour without doing the math yourself.

Inputs

NameTypeDefaultDescription
input*stringColor in any notation.

Response

Modes: json. Cache: yes (24h TTL).

Code samples

Built from the tomato example.


curl -X POST https://api.xtract.bot/api/color-convert \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "input": "tomato"
}'