Palette From Image
Steal a color palette from any reference image — no scikit-learn required
- image
- palette_string
- color_1
- color_2
- color_3
- color_4
- color_5
- color_6
- color_7
- color_8
- primary
- secondary
- accent
- neutral
- metallic
- palette_preview
- source_annotated
- palette_info
Color Palette Generator invents palettes from color theory. This node steals them from reality. Drop in any image - a mood board, a photo of a scene you like, an outfit reference - and it clusters the pixels with K-Means, maps each cluster to a named color, and hands you the same output shape as its sibling: a palette_string for Prompt Color Replace plus individual color and role outputs. It's the "build the wardrobe from the reference image" move for character work, and it costs nothing extra because the K-Means is implemented in pure numpy. No scikit-learn dependency to fight with.
The three extraction modes
dominant- sorts clusters by pixel count. You get the colors that actually fill the image. Simple, and often the most faithful to the source.vibrant- sorts by saturation instead. Same clusters, re-ordered toward the vivid ones. Good when the reference is muted but you want the feel of it, louder.fashion_aware- greedy max-hue-distance selection. This is the interesting one: it tries to pick colors that are distinct from each other in hue, which is what you want for an outfit where each garment needs to read as a different color rather than five shades of the same one.
Two booleans do real work for fashion use: ignore_background and ignore_skin (both default on). Skin tones and backgrounds are exactly the pixels that dominate a portrait's histogram and the least useful for deciding what the character should wear. Turn these on for outfit extraction and the palette stops being "beige, tan, more beige."
The knobs that matter
sample_region-full,center_crop,upper_half, orlower_half. When your reference is a full-body shot and you only care about the top's colors, sample theupper_half. Obvious once you see it, transformative for wardrobe work.num_colors- 2–8, default 5. Five maps cleanly to the five semantic roles (primary/secondary/accent/neutral/metallic).saturation_threshold- minimum saturation a color needs to count. 0.1 default filters out near-grays.include_neutrals/include_metallics- keep the desaturated grays and the gold/silver names in play. For a night-out look you might drop neutrals; for streetwear you'll want them.seed- K-Means initialization is seeded, so the same image + same seed gives the same palette. If you want variety, change the seed rather than the image.
Outputs mirror the generator exactly - palette_string, color_1–color_8, the five role outputs, palette_preview (swatch), plus one extra: source_annotated, the original image with color regions highlighted, so you can see which pixels produced which palette entry. palette_info explains the extraction.
Installing
Identical to its sibling - zero dependencies beyond numpy:
cd ComfyUI/custom_nodes
git clone https://github.com/ping1979ping/comfyui-FVMtools
Restart ComfyUI. No models, no downloads. This whole color corner of the pack is the "just works" zone.
Where it trips people up
The named-color mapping is approximate - the node maps each cluster to the closest of its 161 named colors, so a weird pixel-average can come back as a color that looks wrong on screen even though the cluster was right. Check source_annotated before trusting the names, and remember saturation_threshold and sample_region are the levers that fix most bad extractions. Also: a heavily filtered or HDR reference (all pink neon or crushed shadows) will extract a palette that reflects the filter, not the scene. For palette theft, plain references beat stylized ones.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| num_colors | INT | 52–8 | — |
| extraction_mode | COMBO | 3 options: dominant, vibrant, fashion_aware | |
| ignore_background | BOOLEAN | true | — |
| ignore_skin | BOOLEAN | true | — |
| sample_region | COMBO | 4 options: full, center_crop, upper_half, lower_half | |
| saturation_threshold | FLOAT | 0.100–1 | — |
| include_neutrals | BOOLEAN | true | — |
| include_metallics | BOOLEAN | true | — |
| seed | INT | 00–4294967295 | — |
Outputs (17)
| Name | Type | Description |
|---|---|---|
| palette_string | STRING | — |
| color_1 | STRING | — |
| color_2 | STRING | — |
| color_3 | STRING | — |
| color_4 | STRING | — |
| color_5 | STRING | — |
| color_6 | STRING | — |
| color_7 | STRING | — |
| color_8 | STRING | — |
| primary | STRING | — |
| secondary | STRING | — |
| accent | STRING | — |
| neutral | STRING | — |
| metallic | STRING | — |
| palette_preview | IMAGE | — |
| source_annotated | IMAGE | — |
| palette_info | STRING | — |