Colour palette from image
image_paletteExtract an image's main colors with their percentage share, returning hex/RGB values as CSS variables or JSON and optionally saving a swatch PNG.
Instructions
Extract the main colours of an image with their share of the picture: k-means (default, deterministic) or median cut, 1-16 colours, sorted by share. Transparent pixels are ignored. Returns hex + rgb + % per colour, CSS custom properties (:root { --color-1 … }) or JSON, and optionally writes the website's swatch strip as palette.png. Same algorithm and sampling as the website, so the colours match. Web version: https://s3eidat.github.io/palette-from-image/
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"image": "<image>"
},
"name": "image_palette"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of colours. Default 6. | |
| image | Yes | The image: a local file path (absolute, or relative to the server's --root) or base64 data (raw or a data: URI). | |
| format | No | Export text format. Default css. | css |
| method | No | kmeans (default) or median (median cut). | kmeans |
| output | No | Where to write palette.png (file path or folder ending in "/"). Implies swatchPng. | |
| swatchPng | No | Also write palette.png (160×200 swatch per colour with its hex code). |