Clean.tools Color API

Color conversion, palettes, and accessibility — deterministic.

Operations 4

POST /v1/color_palette Use this when you need color-harmony palettes derived from one base hex color #
POST /v1/color_contrast Use this when checking whether a text/background color pair meets WCAG 2.x… #
POST /v1/css_gradient Use this when you need a ready-to-paste CSS gradient value from 2-5 hex color… #
POST /v1/convert_color Use this when you need one color's exact values across every common format #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/clean-tools:clean-tools-color-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

clean-tools-color-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Clean.tools Color API
  version: 0.1.0
  summary: Read-only developer, finance, date, and text utilities. No key, no signup.
  description: 'Every endpoint is read-only and side-effect-free. Most tools are deterministic: same input, same output. The generator tools (uuid_v4, generate_id, random_number, generate_password) use cryptographic randomness instead. Requests are processed in memory and never written to storage or logs; only anonymous per-tool call counters are kept. The same tools are available over the Model Context Protocol at POST /mcp (mount a subset with ?tools=). Rate limit: about 60 requests/minute per caller — honor Retry-After on 429 and add jitter.'
  license:
    name: MIT
  contact:
    name: Clean.tools
    url: https://clean.tools/
    email: support@clean.tools
servers:
- url: https://api.clean.tools
tags:
- name: color
  description: Color conversion, palettes, and accessibility — deterministic.
paths:
  /v1/color_palette:
    post:
      operationId: color_palette
      summary: Use this when you need color-harmony palettes derived from one base hex color
      description: 'Use this when you need color-harmony palettes derived from one base hex color. Rotates hue/lightness in HSL to build complementary (+180 degrees), analogous (-30/+30), triadic (+120/+240), split-complementary (+150/+210), and monochromatic (lightness steps) swatch sets, each as an array of hex strings. Accepts a 6-digit hex with or without a leading ''#'' (case-insensitive). Deterministic: same input, same output. Example: {color:''#e11d48''} -> base ''#e11d48'', complementary [''#e11d48'',''#1de1b6''], monochromatic [''#590c1d'',''#9d1432'',''#e11d48'',''#eb607e'',''#f3a4b5'']. Note: grayscale inputs (e.g. ''#000000'') have no defined hue, so the hue-rotated sets are all identical and only the monochromatic lightness steps differ.'
      x-read-only: true
      tags:
      - color
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                color:
                  type: string
                  description: A 6-digit hex color, with or without a leading '#', e.g. "#e11d48" or "e11d48". Case-insensitive.
              required:
              - color
            example:
              color: '#e11d48'
      responses:
        '200':
          description: Structured tool result.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tool:
                    type: string
                  result:
                    type: object
                    properties:
                      base:
                        type: string
                        description: Normalized base color as a 6-digit hex string (lowercased, with leading '#').
                      complementary:
                        type: array
                        items:
                          type: string
                        description: '[base, hue+180] — 2 hex swatches.'
                      analogous:
                        type: array
                        items:
                          type: string
                        description: '[hue-30, base, hue+30] — 3 hex swatches.'
                      triadic:
                        type: array
                        items:
                          type: string
                        description: '[base, hue+120, hue+240] — 3 hex swatches.'
                      splitComplementary:
                        type: array
                        items:
                          type: string
                        description: '[base, hue+150, hue+210] — 3 hex swatches.'
                      monochromatic:
                        type: array
                        items:
                          type: string
                        description: 5 hex shades stepping lightness by -30, -15, 0, +15, +30 from the base; the two darker steps are floored at lightness 5 and 10, and the two lighter steps capped at 90 and 95.
                    required:
                    - base
                    - complementary
                    - analogous
                    - triadic
                    - splitComplementary
                    - monochromatic
                    additionalProperties: false
              example:
                tool: color_palette
                result:
                  base: '#e11d48'
                  complementary:
                  - '#e11d48'
                  - '#1de1b6'
                  analogous:
                  - '#e11daa'
                  - '#e11d48'
                  - '#e1541d'
                  triadic:
                  - '#e11d48'
                  - '#48e11d'
                  - '#1d48e1'
                  splitComplementary:
                  - '#e11d48'
                  - '#1de154'
                  - '#1daae1'
                  monochromatic:
                  - '#590c1d'
                  - '#9d1432'
                  - '#e11d48'
                  - '#eb607e'
                  - '#f3a4b5'
        '400':
          description: Invalid input or the tool reported an error.
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                properties:
                  error:
                    type: string
                    description: Human-readable, structured error message.
                  code:
                    type: string
                    description: Stable machine-readable error code.
                  tool:
                    type: string
                    description: Tool name, when the error is tool-specific.
        '413':
          description: Request body exceeds the 128 KB limit.
        '429':
          description: Rate limit exceeded; the response carries Retry-After and RateLimit-* headers — honor them and add jitter.
  /v1/color_contrast:
    post:
      operationId: color_contrast
      summary: Use this when checking whether a text/background color pair meets WCAG 2.x…
      description: 'Use this when checking whether a text/background color pair meets WCAG 2.x accessibility contrast. Computes the relative-luminance contrast ratio (1-21, rounded to 2 decimals) and returns pass/fail booleans for normal and large text at AA and AAA levels (thresholds 4.5 / 7 / 3 / 4.5), plus a suggested passing foreground hex when normal-text AA fails (null when it already passes or none is found). Accepts 3- or 6-digit hex, with or without a leading ''#''; echoed colors are normalized to 6-digit hex. Deterministic: same input, same output. Example: {foreground:''777'', background:''fff''} -> ratio 4.48, normalAA false, largeAA true, suggestedForeground ''#767676''.'
      x-read-only: true
      tags:
      - color
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                foreground:
                  type: string
                  description: 'Foreground (text) color as a 3 or 6 digit HEX string, with or without a leading #, e.g. "#1a1a1a" or "777".'
                background:
                  type: string
                  description: 'Background color as a 3 or 6 digit HEX string, with or without a leading #, e.g. "#ffffff" or "fff".'
              required:
              - foreground
              - background
            example:
              foreground: '777'
              background: fff
      responses:
        '200':
          description: Structured tool result.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tool:
                    type: string
                  result:
                    type: object
                    properties:
                      foreground:
                        type: string
                        description: Normalized foreground color as a 6-digit hex string.
                      background:
                        type: string
                        description: Normalized background color as a 6-digit hex string.
                      ratio:
                        type: number
                        description: WCAG 2.x contrast ratio, 1 to 21, rounded to 2 decimals.
                      normalAA:
                        type: boolean
                        description: Unrounded ratio >= 4.5 (normal text, AA).
                      normalAAA:
                        type: boolean
                        description: Unrounded ratio >= 7 (normal text, AAA).
                      largeAA:
                        type: boolean
                        description: Unrounded ratio >= 3 (large text >=18pt / 14pt bold, AA).
                      largeAAA:
                        type: boolean
                        description: Unrounded ratio >= 4.5 (large text, AAA).
                      suggestedForeground:
                        type:
                        - string
                        - 'null'
                        description: A passing foreground hex (>=4.5 vs the background) when normal-text AA fails; null when the pair already passes or no passing value is found.
                    required:
                    - foreground
                    - background
                    - ratio
                    - normalAA
                    - normalAAA
                    - largeAA
                    - largeAAA
                    - suggestedForeground
                    additionalProperties: false
              example:
                tool: color_contrast
                result:
                  foreground: '#777777'
                  background: '#ffffff'
                  ratio: 4.48
                  normalAA: false
                  normalAAA: false
                  largeAA: true
                  largeAAA: false
                  suggestedForeground: '#767676'
        '400':
          description: Invalid input or the tool reported an error.
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                properties:
                  error:
                    type: string
                    description: Human-readable, structured error message.
                  code:
                    type: string
                    description: Stable machine-readable error code.
                  tool:
                    type: string
                    description: Tool name, when the error is tool-specific.
        '413':
          description: Request body exceeds the 128 KB limit.
        '429':
          description: Rate limit exceeded; the response carries Retry-After and RateLimit-* headers — honor them and add jitter.
  /v1/css_gradient:
    post:
      operationId: css_gradient
      summary: Use this when you need a ready-to-paste CSS gradient value from 2-5 hex color…
      description: 'Use this when you need a ready-to-paste CSS gradient value from 2-5 hex color stops. Builds a linear-gradient(...) (default; direction defaults to ''to bottom'') or a radial-gradient(circle, ...). Direction accepts keywords (''to right'', ''to left'', ''to top'', ''to bottom''), angles (''45deg'', ''90deg'', ''135deg''), or ''to ''; it is ignored for radial, and passing type ''radial'' (or direction ''radial'') forces a radial gradient. Colors accept 6-digit hex with or without a leading ''#'' and are echoed normalized in order. Deterministic: same input, same output. Example: {colors:[''#3b82f6'',''8b5cf6'']} -> css ''linear-gradient(to bottom, #3b82f6, #8b5cf6)'', type ''linear''. Radial results omit the ''direction'' field.'
      x-read-only: true
      tags:
      - color
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                colors:
                  type: array
                  items:
                    type: string
                  minItems: 2
                  maxItems: 5
                  description: 2 to 5 color stops as 6-digit hex strings, with or without a leading '#', e.g. ["#3b82f6", "8b5cf6"].
                type:
                  type: string
                  enum:
                  - linear
                  - radial
                  description: Gradient type. Defaults to "linear". "radial" produces radial-gradient(circle, ...).
                direction:
                  type: string
                  description: 'Linear direction: a keyword ("to right", "to left", "to bottom", "to top"), an angle ("45deg", "135deg", "90deg"), or "to <side> <side>". Defaults to "to bottom". Ignored for radial; passing "radial" here forces a radial gradient.'
              required:
              - colors
            example:
              colors:
              - '#3b82f6'
              - 8b5cf6
      responses:
        '200':
          description: Structured tool result.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tool:
                    type: string
                  result:
                    type: object
                    properties:
                      css:
                        type: string
                        description: 'Ready-to-paste CSS gradient value, e.g. ''linear-gradient(to bottom, #3b82f6, #8b5cf6)'' or ''radial-gradient(circle, #3b82f6, #8b5cf6)''.'
                      type:
                        type: string
                        enum:
                        - linear
                        - radial
                        description: Resolved gradient type.
                      direction:
                        type: string
                        description: Resolved linear direction (keyword or angle). Present only for linear gradients; omitted for radial.
                      colors:
                        type: array
                        items:
                          type: string
                        description: Normalized 6-digit hex color stops, in input order.
                    required:
                    - css
                    - type
                    - colors
              example:
                tool: css_gradient
                result:
                  css: 'linear-gradient(to bottom, #3b82f6, #8b5cf6)'
                  type: linear
                  direction: to bottom
                  colors:
                  - '#3b82f6'
                  - '#8b5cf6'
        '400':
          description: Invalid input or the tool reported an error.
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                properties:
                  error:
                    type: string
                    description: Human-readable, structured error message.
                  code:
                    type: string
                    description: Stable machine-readable error code.
                  tool:
                    type: string
                    description: Tool name, when the error is tool-specific.
        '413':
          description: Request body exceeds the 128 KB limit.
        '429':
          description: Rate limit exceeded; the response carries Retry-After and RateLimit-* headers — honor them and add jitter.
  /v1/convert_color:
    post:
      operationId: convert_color
      summary: Use this when you need one color's exact values across every common format
      description: 'Use this when you need one color''s exact values across every common format. Accepts a hex (#abc or #aabbcc), rgb(r, g, b) with r/g/b 0-255, or hsl(h, s%, l%) color and returns hex, rgb {r,g,b}, hsl {h,s,l}, hsv {h,s,v}, cmyk {c,m,y,k}, and oklch {l,c,h} (CSS Color 4: sRGB -> linear -> OKLab -> OKLCH, rounded to 4 decimals). Note oklch.l is 0-1 (not 0-100) and hue is 0 for grays. Deterministic: same input, same output. Example: "#ff0000" -> oklch {l: 0.628, c: 0.2577, h: 29.2339}. Alpha channels are not supported.'
      x-read-only: true
      tags:
      - color
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                color:
                  type: string
                  description: 'A color as hex (#abc or #aabbcc), rgb(r, g, b) with r/g/b 0-255, or hsl(h, s%, l%). Alpha is not supported.'
              required:
              - color
            example:
              color: '#ff0000'
      responses:
        '200':
          description: Structured tool result.
          content:
            application/json:
              schema:
                type: object
                properties:
                  tool:
                    type: string
                  result:
                    type: object
                    additionalProperties: false
                    required:
                    - hex
                    - rgb
                    - hsl
                    - hsv
                    - cmyk
                    - oklch
                    properties:
                      hex:
                        type: string
                        description: 6-digit lowercase hex, e.g. '#ff0000'.
                      rgb:
                        type: object
                        additionalProperties: false
                        required:
                        - r
                        - g
                        - b
                        properties:
                          r:
                            type: integer
                            description: Red 0-255.
                          g:
                            type: integer
                            description: Green 0-255.
                          b:
                            type: integer
                            description: Blue 0-255.
                      hsl:
                        type: object
                        additionalProperties: false
                        required:
                        - h
                        - s
                        - l
                        properties:
                          h:
                            type: integer
                            description: Hue 0-360 degrees (0 for grays).
                          s:
                            type: integer
                            description: Saturation 0-100 percent.
                          l:
                            type: integer
                            description: Lightness 0-100 percent.
                      hsv:
                        type: object
                        additionalProperties: false
                        required:
                        - h
                        - s
                        - v
                        properties:
                          h:
                            type: integer
                            description: Hue 0-360 degrees.
                          s:
                            type: integer
                            description: Saturation 0-100 percent.
                          v:
                            type: integer
                            description: Value/brightness 0-100 percent.
                      cmyk:
                        type: object
                        additionalProperties: false
                        required:
                        - c
                        - m
                        - y
                        - k
                        properties:
                          c:
                            type: integer
                            description: Cyan 0-100 percent.
                          m:
                            type: integer
                            description: Magenta 0-100 percent.
                          y:
                            type: integer
                            description: Yellow 0-100 percent.
                          k:
                            type: integer
                            description: Key/black 0-100 percent.
                      oklch:
                        type: object
                        additionalProperties: false
                        required:
                        - l
                        - c
                        - h
                        properties:
                          l:
                            type: number
                            description: OKLCH lightness 0-1 (not 0-100), rounded to 4 decimals.
                          c:
                            type: number
                            description: OKLCH chroma, rounded to 4 decimals.
                          h:
                            type: number
                            description: OKLCH hue 0-360 degrees (0 for grays), rounded to 4 decimals.
              example:
                tool: convert_color
                result:
                  hex: '#ff0000'
                  rgb:
                    r: 255
                    g: 0
                    b: 0
                  hsl:
                    h: 0
                    s: 100
                    l: 50
                  hsv:
                    h: 0
                    s: 100
                    v: 100
                  cmyk:
                    c: 0
                    m: 100
                    y: 100
                    k: 0
                  oklch:
                    l: 0.628
                    c: 0.2577
                    h: 29.2339
        '400':
          description: Invalid input or the tool reported an error.
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                properties:
                  error:
                    type: string
                    description: Human-readable, structured error message.
                  code:
                    type: string
                    description: Stable machine-readable error code.
                  tool:
                    type: string
                    description: Tool name, when the error is tool-specific.
        '413':
          description: Request body exceeds the 128 KB limit.
        '429':
          description: Rate limit exceeded; the response carries Retry-After and RateLimit-* headers — honor them and add jitter.
externalDocs:
  description: LLM guide
  url: https://api.clean.tools/llms.txt