ComfyUI Node

Ideogram Palette Override

Tweak the Extracted Palette Before It Becomes a Prompt

By SurrealByDesign·Created 2 months ago·Updated 2 months ago· 3
Ideogram Palette Override
    • palette_json
    • palette_preview
    palette_json
    max_colors16
    add_colors
    remove_index

    An automatic extractor is a great first draft, but it's rarely the final word. IdeogramPaletteExtractor looks at your reference image and says "here are the eight colors that dominate." IdeogramPaletteOverride is the node you drop in when you look at that palette and think "…except that muddy brown, and also I want my brand orange in there."

    It's the manual-editing station between extraction and JSON assembly: add colors, remove specific indices, clamp the total count, and get a cleaned-up palette plus a fresh swatch preview. If you've ever run an extractor and immediately wished for a filter, this is it.

    The inputs that matter

    • palette_json (required) - the array of hex strings from any palette node.
    • max_colors (default 16) - clamps the result to at most this many. This is how you trim a 16-color extraction down to the 8 you actually want to feed Ideogram. The range is 1–16, matching Ideogram's global palette ceiling.
    • add_colors (optional) - a comma-separated list of hex codes, e.g. #FF6B35,#1B1B1B. These get appended to the palette (respecting max_colors). This is the "my brand orange" input.
    • remove_index (optional) - comma-separated indices to delete, e.g. 0,4 to drop the first and fifth colors. Note it's index, not hex value - the index in the order the palette arrived in.

    Outputs are the same shape as the extractor's: palette_json (the edited array) and palette_preview (a swatch strip IMAGE). Keep the preview in your graph; it's the fastest way to sanity-check an edit without decoding JSON.

    Why the index-based removal matters

    This is the one input that trips people up, so it's worth saying plainly: you remove by position, not by color. The palette comes out ordered by dominance, so remove_index: 0 deletes the most dominant color, remove_index: 1 the second, and so on. There's no "remove #8B4513" - if you want that specific brown gone, count its position in the swatch preview (or look at the JSON) first. Mildly annoying, but consistent, and the swatch strip makes counting easy since it's rendered in the same order.

    Where it sits in the chain

    The repo's example workflow wires it exactly where you'd expect:

    LoadImage → IdeogramPaletteExtractor → IdeogramPaletteOverride → IdeogramPaletteToGlobalJSON
                                      ↘ PreviewImage
    

    The override also shows up in the masked-subject showcase, where it's used to clamp a subject's palette down to ≤5 colors before it becomes an element palette. So it's not just for global palettes - if you need a 6-color extraction squeezed into the 5-color element budget, this is the tool.

    Installing it

    One pack, all fifteen nodes. ComfyUI Manager: search "Ideogram Palette and Prompt Tools". Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SurrealByDesign/ComfyUI-Ideogram-Palette-and-Prompt-Tools
    

    Restart ComfyUI. Only extra dependency: scikit-learn (auto-installed by Manager, or pip install scikit-learn). torch/numpy/Pillow deliberately not pinned - they ship with ComfyUI. Nodes under Ideogram/Palette, Python ≥ 3.10, tested on ComfyUI 0.24.0 / Python 3.12.

    Gotchas and troubleshooting

    • Removed a color and nothing changed? Check your indices - if the palette only has 6 entries and you passed remove_index: 8, there's nothing to remove at that position. Blank/invalid indices are skipped gracefully.
    • add_colors order is appending, not prepending. Added colors go to the end of the array unless max_colors trims them. Since Ideogram consumes the palette in order (dominance-first), a new color that matters should be added early or the output reordered.
    • Can't get under max_colors floor of 1? Correct - a palette of zero colors would break the downstream JSON. The clamp is a safety rail.
    • Malformed hex in add_colors? It's skipped with a warning rather than crashing the graph. The pack's whole design philosophy is graceful failure.
    CategoryIdeogram/Palette

    Inputs (4)

    NameTypeDefaultDescription
    palette_jsonSTRING
    max_colorsINT161–16
    add_colorsoptSTRING
    remove_indexoptSTRING

    Outputs (2)

    NameTypeDescription
    palette_jsonSTRING
    palette_previewIMAGE