Extract Prevalent Colors
Steal the palette, not the pixels
- image
- colors
- palette grid
- color names
- palette description
Ever stared at a reference image and wished you could hand its color story to the generator instead of describing it with words? That's this node. Feed it an image and it pulls out the perceptually distinct colors that actually dominate the picture - the ones your eyes notice, not a histogram's noisy top-8 - and hands them to you as hex codes, a swatch grid, human color names, and a plain-English palette description.
The natural consumer is any prompt model that speaks hex. Ideogram 4 is the poster child here: it was trained on structured captions that include hex color palettes and bounding boxes, and plain prose underperforms badly with it. Wire this node's colors string into your Ideogram prompt and you get an exact-match palette instead of a lucky guess. But it's equally useful for the older trick of matching a reference's mood with a color-consistency LoRA, or just pasting the swatch grid into a control image for a regional workflow.
How it works
The brief says "without resizing or spatial sampling," and that's the honest part of the design: it builds a weighted RGB histogram over every pixel in the image, converts to a perceptual color space, clusters it, and merges clusters down to your requested count. Because the clustering happens in a space where distance tracks what you perceive as different, you don't get eight near-identical browns from a photo that is 90% brown. The palette description output is computed deterministically from the palette (temperature, lightness, chroma, neutrality, contrast) - no model involved, which is nice because it's reproducible run to run.
The inputs that matter
Only three inputs, and you'll touch two of them:
color_count- maximum colors per image, 1–64, default 8. Bump it for a detailed scene, drop to 4–5 for a clean brand-style palette.prefix_hash- whether the hex codes come back as#rrggbborrrggbb. Leave it on unless your target prompt format wants bare hex.image- any image or image batch; every image in the batch gets its own palette.
The four outputs
colors- one comma-separated palette, most prevalent to least. This is the one to feed a text prompt.palette grid- an IMAGE of color blocks in reading order, ready for preview or as a conditioning image. Unused cells flatten to black.color names- nearest human-readable names ("burnt sienna", "teal") in the same order, for when a model reacts better to words than codes.palette description- the deterministic one-liner above.
Installing it
From ComfyUI Manager, search "ComfyUI-UtilsCollection" and hit install. Or do it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Then restart ComfyUI. Dependencies are light (opencv-python and typing-extensions - this pack needs no model downloads for its image utilities, and none of these nodes call an API). One thing to know: this pack is built on the newer ComfyExtension API, so keep ComfyUI reasonably current or the nodes won't register.
Where people get burned: feeding colors to a model that doesn't understand hex. The string is #8a5a44, #d8c3a5, ... - great for Ideogram 4, ignored by plain SDXL CLIP. And the palette description isn't a vibe, it's a measurement; don't expect it to rhyme with what you'd call a "sunset."
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| color_count | INT | 81–64 | Maximum number of prevalent colors returned per image. |
| prefix_hash | BOOLEAN | true | Prefix every six-digit hexadecimal color with #. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| colors | STRING | One comma-separated palette ordered from most prevalent to least prevalent. |
| palette grid | IMAGE | RGB color blocks in reading order from the top-left. Unused cells are flattened to black. |
| color names | STRING | Nearest human color names in the same order as the exact hexadecimal colors. |
| palette description | STRING | Deterministic palette-level temperature, lightness, chroma, neutrality, and contrast description. |