Zum Inhalt
HALOWERK

Medienwerk

image palette

Takes an image by URL or inline base64 and returns its colour palette: up to sixteen colours, each with the share of the visible area it covers, its HEX and sRGB values, its OKLCH coordinates, and the WCAG 2.1 contrast ratio against white, against black and against every other colour in the palette. The grouping runs in OKLab rather than RGB, because distance in RGB does not match what an eye sees — it merges dark blue with black and splits two yellows nobody tells apart.

POST https://medien.halowerk.com/v1/image-palette

Eingaben

Felder des veröffentlichten Eingabeschemas
FeldTypPflichtBeschreibung
sourceobjectJaThe image. Either url or content_base64, not both.
max_colorsintegerNeinUpper bound on palette size. Clusters whose share falls below min_share_pct are merged into their nearest neighbour, so the answer can contain fewer.
min_share_pctnumberNeinMinimum area share in percent for a colour to stay in the palette. Below this it is merged into the perceptually nearest remaining colour and counted under merged_clusters.
include_contrastbooleanNeinReturn WCAG 2.1 contrast ratios: against white and black per colour, and the full pairwise matrix.
Vollständiges Eingabeschema anzeigen
{
  "type": "object",
  "required": [
    "source"
  ],
  "additionalProperties": false,
  "properties": {
    "source": {
      "type": "object",
      "additionalProperties": false,
      "description": "The image. Either url or content_base64, not both.",
      "properties": {
        "url": {
          "type": "string",
          "maxLength": 2048,
          "description": "Public http(s) URL of the image."
        },
        "content_base64": {
          "type": "string",
          "maxLength": 12000000,
          "description": "The image inline, base64."
        },
        "filename": {
          "type": "string",
          "maxLength": 260
        }
      }
    },
    "max_colors": {
      "type": "integer",
      "minimum": 2,
      "maximum": 16,
      "default": 6,
      "description": "Upper bound on palette size. Clusters whose share falls below min_share_pct are merged into their nearest neighbour, so the answer can contain fewer."
    },
    "min_share_pct": {
      "type": "number",
      "minimum": 0,
      "maximum": 50,
      "default": 1,
      "description": "Minimum area share in percent for a colour to stay in the palette. Below this it is merged into the perceptually nearest remaining colour and counted under merged_clusters."
    },
    "include_contrast": {
      "type": "boolean",
      "default": true,
      "description": "Return WCAG 2.1 contrast ratios: against white and black per colour, and the full pairwise matrix."
    }
  }
}

Originalschema öffnen

Veröffentlichtes Eingabebeispiel

{
  "source": {
    "content_base64": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAKklEQVR42mO4aGKBB+l1h+NBDKOaRzUT1CzvtwIPenFECw8a1TyqmaBmACXxCf9EgyxCAAAAAElFTkSuQmCC",
    "filename": "beispiel.png"
  },
  "max_colors": 4,
  "min_share_pct": 1,
  "include_contrast": true
}

Ergebnis & Dokumentation

Maschinenlesbare Dokumentation dieses Hubs

Quelle dieser Seite: der veröffentlichte HALOWERK-Katalog. Stand: 2026-11-01, 15:19 UTC.

Weitere Endpunkte dieses Hubs

Alle Endpunkte dieses Hubs →