ComfyUI Node

Ideogram Prompt Assembler

Splice a Palette Into Your Prompt Without Touching Anything Else

By SurrealByDesign·Created 2 months ago·Updated 2 months ago· 3
Ideogram Prompt Assembler
    • prompt_json
    • report
    base_json{}
    merge_json
    fix_key_ordertrue

    The palette pipeline gives you a style_description fragment. Your full Ideogram prompt is a much bigger JSON object with subjects, composition, and all the rest. Getting the palette into that object without clobbering the rest is the job of IdeogramPromptAssembler - it deep-merges a JSON fragment into a base prompt, field by field, leaving everything else untouched.

    This is the node that makes the colorway-study workflow work. Wire a style_description fragment (from IdeogramPaletteToGlobalJSON) in as merge_json, your full prompt as base_json, and it injects only style_description.color_palette while sibling fields like aesthetics, lighting, photo, and medium - plus the entire rest of the prompt - stay exactly as they were. Swap the fragment, hold the seed, and the same scene re-renders in a different colorway.

    Inputs

    • base_json (default "{}") - your full prompt JSON. A literal "{}" lets you assemble a prompt from scratch, since the merge starts from an empty object.
    • merge_json - the fragment to merge in. For the flagship use case this is the style_json output of IdeogramPaletteToGlobalJSON.
    • fix_key_order (BOOLEAN, default True) - reorders keys to Ideogram's canonical ordering after merging, reusing the pack's key-order logic.

    Outputs: prompt_json (the merged, key-ordered result) and report (a summary of exactly what was merged - this is your debug friend).

    What "deep merge" means here

    Shallow merges replace whole sub-objects. If a shallow merge hit style_description, it would replace the entire style block - wiping your aesthetics and lighting text just because you wanted to swap the palette. The assembler merges recursively, so a fragment that only defines color_palette lands inside style_description and modifies just that one field. That's the behavior the README is careful to spell out, and it's the difference between "update one thing" and "nuke my whole style block."

    The report output tells you what actually merged, which matters more than you'd think - a fragment that failed to parse produces a report you can read instead of a silently wrong prompt.

    Installing it

    Part of the pack. 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 (Manager installs it, or pip install scikit-learn). torch/numpy/Pillow deliberately not pinned. Nodes under Ideogram/Palette, Python ≥ 3.10, tested on ComfyUI 0.24.0 / Python 3.12.

    Gotchas and troubleshooting

    • Palette didn't change but the merge "worked"? Read report. If it says nothing about color_palette, your merge_json fragment didn't carry it - check that IdeogramPaletteToGlobalJSON actually got a palette array, not an empty one.
    • merge_json must be a JSON fragment, not a raw array. A bare ["#FF0000", …] won't merge into style_description correctly; that's what the wrapper node is for.
    • This node merges; it doesn't validate. Run the output through IdeogramJSONValidator before generation, especially on a from-scratch "{}" build.
    • Key order still matters after merge. That's why fix_key_order defaults to True - leave it on unless you're deliberately preserving a non-canonical order for some reason.
    CategoryIdeogram/Palette

    Inputs (3)

    NameTypeDefaultDescription
    base_jsonSTRING{}
    merge_jsonSTRING
    fix_key_orderBOOLEANtrue

    Outputs (2)

    NameTypeDescription
    prompt_jsonSTRING
    reportSTRING