CsCPaletteEditor
Recolor a flat image by swatch number — without touching a brush
- images
- palette
- index_maps
- images
- palette
- mask
CsCPaletteEditor is the recolor half of the ComfyUI-ColorshiftColor pack. Wire in the three things ColorshiftColor gives you - the quantized images, the palette, and the index_maps - and this node edits the palette in HSV space, then rebuilds every pixel from the index map. Because the segmentation was decided up front, you can shift the whole image's hue, drain the saturation, or darken one region, and the flat edges stay razor sharp the entire time. No masks, no lasso, no repainting.
The name is doing real work: you edit a palette and the image follows automatically.
The inputs that matter
The three required wires come straight out of ColorshiftColor: images, palette, index_maps. From there it's sliders plus two strings:
hue_shift(−180 to 180) - rotates hue in degrees. This is the "make the whole thing blue instead of red" knob.saturation_scaleandvalue_scale(0–5, default 1) - multiply saturation and brightness. 1 leaves them alone; 0.2 is nearly grayscale.lock_color_num(default"0,") plusmask_enable- protect specific swatches from everything above. Enter numbers from the palette preview, comma-separated, e.g.0,1,4. Withmask_enableoff, nothing is locked.invert_maskflips the protection to "only these change."operations- the power tool: a JSON list that pins exact colors per swatch, overriding the sliders. Format below.
Each slider group also has its own random toggle - hue_random_enable, saturation_random_enable, value_random_enable - with a shared seed at the top. Flip hue random on and each run picks a different shift in the ±180 range - instant variant batches, and the seed makes them reproducible. It's the most fun setting in the pack for churning out recolors of the same base image.
The operations JSON
The sliders are global; operations is per-swatch. It's a JSON list, exactly as shown in the README:
[{"index": 0, "color": [0.0, 0.0, 1.0]}]
That pins swatch 0 to pure blue. There's also an "hsv" variant ({"index": 1, "hsv": [0.6, 0.8, 0.9]}) if you'd rather specify hue/sat/value directly, and you can comma-separate multiple objects to set several swatches at once. The README warns that the index numbers have to line up with the numbering in palette_preview - and with lock_color_num if you're mixing both.
What comes out
images- the recolored flat image.palette- the edited palette. Feed it back into ColorshiftColor'spalette_overrideand the two nodes form a loop: quantize, edit, re-quantize against your new palette.mask- a per-pixel float mask of the regions that were locked (or unlocked, if you inverted). Handy when you want the protected areas as a real mask for something downstream.
Install & gotchas
Same pack, same install: search "ComfyUI-ColorshiftColor" in ComfyUI Manager, or clone https://github.com/852wa/ComfyUI-ColorshiftColor into ComfyUI/custom_nodes, then make sure scikit-learn is present (pip install scikit-learn). Restart ComfyUI. No models, no API keys.
Two things bite people:
- The
index_mapsinput is typed MASK but carries integer labels (0, 1, 2...), not alpha floats. Treat it as an index map and don't panic when it looks odd in a mask preview. - If dragging sliders changes nothing, check
mask_enableandlock_color_num- a non-empty lock list with the mask on is exactly how you freeze everything by accident.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| palette | PALETTE | — | |
| index_maps | MASK | — | |
| seedopt | INT | 00–18446744073709550000 | — |
| hue_random_enableopt | BOOLEAN | false | — |
| hue_shiftopt | FLOAT | 0.00-180–180 | — |
| saturation_random_enableopt | BOOLEAN | false | — |
| saturation_scaleopt | FLOAT | 1.000–5 | — |
| value_random_enableopt | BOOLEAN | false | — |
| value_scaleopt | FLOAT | 1.000–5 | — |
| lock_color_numopt | STRING | 0, | — |
| mask_enableopt | BOOLEAN | false | — |
| invert_maskopt | BOOLEAN | false | — |
| operationsopt | STRING | [] | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| palette | PALETTE | — |
| mask | MASK | — |