Gradient Between Indices
Smooth out the rough spots in an existing palette
- palette
- gradient_palette
Gradient Between Indices is the fix-it node. Where Create Gradient Palette builds a ramp from scratch, this one takes a palette you already have and smooths out the middle of it. You point at two colors by their index positions - say slot 0 and slot 5 - and the node re-interpolates every color between them, replacing the in-between steps with a clean gradient. It's how you rescue a palette where two adjacent colors clash or the middle shades feel like they jumped instead of stepped.
The mechanism is what makes it worth having. The source palette is deep-copied, then only the colors strictly between your two indices are replaced - the endpoint colors at index_start and index_end are preserved exactly, and their names carry over to the new interpolated steps. So you're not rebuilding the palette, you're healing a segment of it. Load a 32-color skin ramp, find the one band that's off, and blend it out without touching the rest.
How it works
PixelPalette.create_gradient(index1, index2, color_space) validates that index_start < index_end, that the bounds are in range, and - importantly - that there's at least one color between them. If you pick adjacent indices (0 and 1), there's nothing to interpolate and it errors out cleanly, returning the original palette. The color_space dropdown gives you the same RGB vs HSV tradeoff as the rest of the pack: RGB is linear and predictable, HSV follows the color wheel and handles red→green-style transitions far more naturally.
Inputs and outputs
palette(PIXEL_PALETTE) - the source.index_start(INT, default 0) - first kept color.index_end(INT, default 2, min 1) - last kept color.color_space-rgborhsv.
Output: gradient_palette, a new PIXEL_PALETTE where the segment between the two indices has been re-interpolated. Note the output is a full palette (same length as the input), not a reduced slice - the segment is replaced in place, not extracted.
Installing
Part of the Pixel Palette Art pack. ComfyUI Manager → "Pixel Palette Art", or:
cd ComfyUI/custom_nodes
git clone https://github.com/ranska/pixel_palette_art.git
Restart ComfyUI; it lives under pixel_art/palette. Dependency is just Pillow.
Common issues
The indexing is where everyone trips. index_start and index_end are inclusive endpoints that survive untouched - only the colors strictly between them get interpolated. Pick 0 and 5 and you get 4 new middle colors (indices 1–4), not a 5-step gradient. And adjacent indices produce an error rather than a no-op, so if you meant "no change", don't call this node.
Second: the endpoint-preservation can look like a bug at the seams. The first and last colors of your segment are literally the same objects as before, so if the original ramp had a jarring jump at exactly slot 5, slot 5 still has it - the node only fixes what's between the bounds you gave. And as always with this pack: output is an object, so wire it into Palette View to actually see whether the fix took.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| palette | PIXEL_PALETTE | Palette contenant les couleurs de départ et d'arrivée | |
| index_start | INT | 00–255 | Index de la couleur de départ |
| index_end | INT | 21–255 | Index de la couleur d'arrivée |
| color_space | COMBO | rgb | Espace de couleur pour l'interpolation |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| gradient_palette | PIXEL_PALETTE | — |