Extract a K-color palette from a TOP
extract_paletteExtract dominant colors from any TOP preview using k-means clustering, returning a sorted palette for AI grading, palettes, and design hand-offs.
Instructions
Sample dominant colors from a TOP by capturing its preview PNG and running deterministic k-means on the decoded RGB pixels. Returns {source_top, k, width, height, pixels_sampled, hex_colors[], swatches[{hex,rgb,weight}], warnings[]} sorted by dominance (most-frequent cluster first). Feeds AI grading prompts, create_palette, and design hand-offs. Read-only; no nodes are created or modified.
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": {
"source_top": "<source_top>"
},
"name": "extract_palette"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | Number of palette colors to extract (2..16). | |
| width | No | Width to render the preview at before sampling (smaller is faster). | |
| height | No | Height to render the preview at before sampling. | |
| source_top | Yes | Path of the TOP to sample colors from. |