Color Palette Extractor
The dead-simple way to pull a color palette out of any image
- image
- hex_list
- dominant_color
- palette_image
You know that moment when you load a reference image, squint at it, and try to describe its color scheme into a prompt? This node kills that. Feed it an image and it hands back the top dominant colors as hex codes plus a little strip of the palette you can actually look at. If you do style-consistency work, or you want a workflow that stays "in the same palette" as a reference, this is the cheapest way to get there.
It's part of DebugPadawan's ComfyUI Essentials, a small MIT-licensed utility pack that does a bit of everything and doesn't try to be a model-suite like Impact Pack or a workflow-organizer like rgthree. It's glue. And for color, the glue is genuinely useful.
How it works
The code is refreshingly honest about what it's doing. It takes the first image in the batch (more on that in a second), shrinks it to 64×64 with area interpolation so it's fast, then quantizes each channel down to 16 levels per bucket - that's the "group similar colors together" trick that keeps noise from dominating. Then it counts how often each quantized color appears, sorts by frequency, and returns the top color_count as lowercase hex strings.
The palette_image output is a generated image: 64 pixels tall, color_count × 64 pixels wide, one solid block per color. Wire that into a Preview Image node and you get a real visual palette, which is way more useful than staring at hex codes.
The inputs and outputs that matter
- image - the IMAGE tensor. Only frame zero gets analyzed, so if you feed it a batch of eight, you get the palette of frame one.
- color_count - how many colors to return, default 5, min 1, max 20. More isn't always better; past 8 or so you're mostly pulling shades of the same dominant hue.
Outputs are hex_list (a single STRING with colors comma-separated, like #4a2c2a, #d9a066, ...), dominant_color (just the top one), and palette_image.
Install
The pack installs like any other custom node:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git
Then restart ComfyUI. Or search "DebugPadawan" in ComfyUI Manager's Custom Nodes and hit Install. requirements.txt lists numpy, torch, and opencv-python - numpy and torch already ship with ComfyUI, and nothing in the shipped node code actually imports cv2, so there are no heavy downloads and no model files to fetch. No API keys either.
Where people get burned
- It only reads the first image of a batch. If you slice out a specific frame first (the pack's Image Batch Slicer does that), you get that frame's palette. Otherwise it's always frame zero.
- The colors are approximate. The 16-level quantization means you get "the dominant bucket," not the exact pixel color. For style matching that's usually a feature, not a bug.
hex_listis one string, not a list. If you want individual colors to feed somewhere, split on the comma - or just grabdominant_colorand be done.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| color_count | INT | 51–20 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| hex_list | STRING | — |
| dominant_color | STRING | — |
| palette_image | IMAGE | — |