CsCFill
Split a flat image into fill and shadow layers in one pass
- images
- palette
- index_maps
- filled_image
- mask_image
CsCFill is the smallest node in the ComfyUI-ColorshiftColor pack and the one with the least obvious name. It's a fill-and-shadow separator: feed it the images, palette, and index_maps that come out of ColorshiftColor, and it pairs the flat colors into fill/shadow pairs, then gives you two outputs - one image with the shadows crushed into their fill colors, and one RGBA layer carrying just the shadows at their original colors, with real alpha.
If you've ever had to clean up cel-style art - separating flats from shadows so you can recolor them independently, or prepping layers to composite elsewhere - this is the shortcut. It's also a nice "crush all shading" pass when you want a cleaner base to re-quantize.
How it works
The default behavior is fully automatic: it finds the closest color pairs in your palette, and within each pair the brighter color becomes the fill (A) and the darker becomes the shadow (B). Every pixel belonging to B gets repainted with A in filled_image, while mask_image paints those same pixels in B's color with alpha = 1. It's RGBA, so the shadow layer composites cleanly on top of the fill.
Each palette color is used exactly once, so an 8-color palette yields up to 4 shadow layers - fine for a couple of shading steps, wrong for subtle gradients. This is a flat-color tool by design.
The manual override
Auto-pairing guesses, and sometimes it guesses wrong. That's what the operations string is for. The README's example:
[{"A": 0, "B": 1}]
...means "color 0 fills color 1," where the numbers are the ones from the palette_preview swatch grid. The node still enforces that the brighter end of the pair ends up as the fill, so you don't have to think about direction.
Inputs and outputs
Required wires: images, palette, index_maps - all three straight from a ColorshiftColor upstream. The only knob is operations (default [], multiline), the JSON pair list above. Outputs are filled_image (the flat, shadow-free image) and mask_image (the RGBA shadow layer) - both plain IMAGEs, ready for SaveImage, a composite node, or the numbered-PNG trick below when you're working on video.
Install
It ships in the same pack as ColorshiftColor, so one install gets all three: search "ComfyUI-ColorshiftColor" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/852wa/ComfyUI-ColorshiftColor
pip install scikit-learn
Restart ComfyUI. No models, no API keys, nothing to download. The one real dependency is scikit-learn (the quantization engine upstream), and the README tells you to install it up front.
Worth knowing
The example workflows pair this with VideoHelperSuite to separate shadows across whole video frame batches - and the README warns that if you're producing single-color-background video, you should save a numbered PNG sequence with SaveImage rather than let the video encoder mangle it. File that one away before your first run.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| palette | PALETTE | — | |
| index_maps | MASK | — | |
| operationsopt | STRING | [] | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| filled_image | IMAGE | — |
| mask_image | IMAGE | — |