Nodes/ComfyUI Colormaster Nodes/๐ŸŸฅ Hex Color โ†’ Image
ComfyUI Node

๐ŸŸฅ Hex Color โ†’ Image

A flat color image in one node โ€” and the swatch workflows it unlocks

By orion4dยทCreated about a year agoยทUpdated about a year agoยท 2
๐ŸŸฅ Hex Color โ†’ Image
    • image
    โ—„hex_color#ffffffโ–บ
    โ—„width1024โ–บ
    โ—„height1024โ–บ

    You type a hex color, out comes a solid image. That's the whole node - but it's one of those boring utilities that quietly powers the workflows you actually end up using. ComfyUI doesn't ship a "make a solid color canvas" node in the base graph, so when you want a swatch, a brand-color backdrop, or a reference block to composite against, you usually end up fiddling with masks and Fill nodes. Hex Color โ†’ Image cuts that to a single box.

    Type #ff6600, set 1024ร—1024, done: a flat orange image ready to wire into anything that takes an IMAGE. If you're building a palette extractor โ†’ swatch โ†’ preview pipeline, this is the node that turns the extracted hex strings back into pixels.

    How it works

    It parses the hex string to RGB, creates a solid-color PIL image at your requested size, and converts it to ComfyUI's standard float tensor format (1,H,W,C, values 0โ€“1). Two details worth knowing:

    • It handles 3-digit hex. #f0a expands to #ff00aa automatically, so shorthand works.
    • A bad hex string doesn't error out - it silently falls back to white. That's the trap: your color "doesn't work" and you get a white image instead of an error message pointing at your typo.

    The inputs

    Just three, and two of them have sensible defaults:

    • hex_color - string, default #ffffff. The # is optional in parsing, but keep it anyway.
    • width / height - integers, default 1024, capped at 8192. Nothing stops you from making a 10ร—10 pixel block if you want a tiny swatch.

    Output is a single image tensor, and since the tensor is batched with one frame, you can pipe it into compositing, image padding, or anything else that expects a normal ComfyUI image.

    Installing it

    Part of the Colormaster pack, so the install is the pack install: ComfyUI Manager โ†’ search "Colormaster" โ†’ install โ†’ restart. Manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/orion4d/ComfyUI_colormaster
    pip install -r requirements.txt   # Pillow, torch, numpy - all already in your env
    

    Restart and you're done. No models, no downloads, and the declared dependencies are ones ComfyUI already has, so install conflicts are unlikely.

    Common issues

    The white-image-on-bad-hex behavior is the one that'll bite you, since the fallback is silent. Double-check your string if you get white - a stray space around the hex (#ff6600 ) breaks parsing too. Also note the size cap of 8192, which is plenty for a color block but worth knowing if you were planning something absurd. Where people actually get value from this node is chaining it: palette extractor โ†’ Select Hex Line โ†’ this node โ†’ a grid of real swatches you can eyeball before you commit a scheme to a prompt. It's not flashy. It's the kind of node that just works and stays in your workflow forever.

    CategoryColormaster

    Inputs (3)

    NameTypeDefaultDescription
    hex_colorSTRING#ffffffโ€”
    widthINT10241โ€“8192โ€”
    heightINT10241โ€“8192โ€”

    Outputs (1)

    NameTypeDescription
    imageIMAGEโ€”