ComfyUI Node

Hex Color Stack

Tell the generator which paint colors you actually own

By Chrisvenator·Created about a year ago·Updated about a year ago· 3
Hex Color Stack
    • hex_stack
    • color_preview
    hex_colors#FFFFFF #F6D300 #F88A00 #E53935 #EF5AA9 #C2187E #7E3F98 #53307A #2847A5 #0062B8 #4FA8F6 #00A9B7 #5AC9B3 #8BC63F #3AAA35 #00783E #C4D600 #F4B183 #C5863A #8B5C2F #000000
    show_previewtrue

    The Hex Color Stack is the thing that makes this whole pack worth installing. Every other paint-by-numbers tool picks the colors for you; this one lets you type in the exact tubes of acrylic you already own, so the finished sheet only uses colors you can actually paint with. The pack's whole pitch is "use arbitrary #RRGGBB values of colors you have lying around at home." This node is that pitch in a box.

    It's also the dumbest node in the pack, which is fine. It's a palette holder - no AI, no GPU, nothing clever. You paste a list of hex codes, one per line, and it hands a structured palette to the other nodes. If you skip it, the preprocessor and the calculator just invent a palette for you; wire it in and they lock onto yours.

    How it works

    The node parses your multiline text, pulling out every hex color it can find. It tolerates both 3-digit and 6-digit hex, with or without the # - #E53935 and e53 both work. It builds a little structure holding the hex codes, their RGB values, and a count, then hands that out as a HEX_STACK - which is a custom type only this pack understands, not a standard ComfyUI type.

    If show_preview is on, it also renders a swatch grid image so you can eyeball the stack without squinting at hex codes.

    The inputs and outputs that matter

    You really only touch one input:

    • hex_colors - multiline text, one hex per line. That's it. There's a sensible 21-color default (white through black with a rainbow in between) if you want to see the shape of the workflow before committing to your own palette.
    • show_preview - toggles the swatch preview image. Leave it on while tuning, turn it off if you're shaving compute.

    Outputs:

    • hex_stack - the palette, wired into Paint by Numbers Preprocessor: K-Mean or Paint by Numbers: Calculate numbers. Plug it into either (or both - they'll stay consistent).
    • color_preview - the swatch grid, mostly for your own sanity.

    How to use it in a workflow

    The README's flow: load your image → preprocess with K-Mean (passing the stack) → convert to lineart with any ControlNet lineart model and invert it → calculate numbers (passing the stack again) → overlay. The one tip the author hammers: put white in your stack, because most paper is white and you'll want a region to be "leave it unpainted."

    Note the preprocessor treats the stack as a cap, not a demand: if your stack has more colors than num_colors, it quietly picks the most representative subset. So you can keep a big "this is everything in my drawer" stack and still control complexity on a per-image basis.

    Installing it

    You're installing the whole pack - this node ships alongside the others. Easiest path is ComfyUI Manager: search "Painting-by-colors-generator" (or "paint by numbers") and install. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Chrisvenator/ComfyUI-Painting-by-colors-generator
    

    Then restart ComfyUI. The README's own clone snippet points at a placeholder URL (your-name/comfyui-paint-by-numbers) - ignore that, the real repo is the one above. No model files to download; the pack is pure Python on top of numpy/Pillow/scikit-learn, which a normal ComfyUI install already has.

    One gotcha to expect: because HEX_STACK is a pack-private type, any workflow you save using it will refuse to load the stack until this pack is installed on the new machine. It's not a bug, it's just how ComfyUI types work.

    Categoryimage/artistic

    Inputs (2)

    NameTypeDefaultDescription
    hex_colorsSTRING#FFFFFF #F6D300 #F88A00 #E53935 #EF5AA9 #C2187E #7E3F98 #53307A #2847A5 #0062B8 #4FA8F6 #00A9B7 #5AC9B3 #8BC63F #3AAA35 #00783E #C4D600 #F4B183 #C5863A #8B5C2F #000000
    show_previewBOOLEANtrue

    Outputs (2)

    NameTypeDescription
    hex_stackHEX_STACK
    color_previewIMAGE