🎨 Rennart Palette Preview
Paste a hex list, get an actual swatch strip
- IMAGE
- COLOR_COUNT
Hex codes are the worst possible way to look at a palette. #7BA05B, #5B8C6E, #7A9A6B - is that a gradient, three greens, or a typo? Rennart Palette Preview turns any string containing hex colors into a horizontal strip of labeled swatches, as a real IMAGE, so you can see what you've got inside ComfyUI instead of alt-tabbing to a color picker site.
What it's actually for
This is the pair node to Rennart Palette Extractor, but it's more useful alone than it looks. It parses text, and it's forgiving about what text - so it's the bridge between palettes coming from everywhere else and the canvas:
- the
palette_jsonfragment from the extractor in the same pack; - a JSON hex array spat out by SurrealByDesign's Ideogram palette tools;
- an LLM that just wrote you a moodboard palette in a chat;
- a palette you typed out of a reference painting by hand.
The reason it earns a slot: structured-prompt workflows are built on hex palettes buried inside a JSON blob, and once the palette is inside a string nobody can tell whether it's right. Rendering it makes the JSON auditable at a glance.
How it works
The parser is a three-tier best-effort, and knowing the tiers explains every confusing result:
json.loadsfirst. If you paste["#FF5733", "#C70039"], that's parsed as a list. If it parses to a bare string, it falls through.- Regex fallback. Otherwise it scans the whole text for
#followed by 3 or 6 hex digits, expands#RGBshorthand to#RRGGBB, and upper-cases everything. - Nothing found → a single
#808080gray swatch.
That regex fallback is why the extractor's output works here even though "color_palette": ["#..."] is not valid JSON on its own - tier 1 throws, tier 2 scrapes the hex codes out. You don't need to strip the key. It's also why the node happily eats messy prose.
Rendering is plain Pillow, no neural anything: each color is a swatch_size × swatch_size block, left to right, with a 24 px dark band underneath holding the uppercase hex, then converted to a float 0–1 ComfyUI IMAGE tensor.
Inputs and outputs
- hex_string - multiline, and it really is any text with hex in it. The extractor's
palette_json, a JSON array,colors: #fff, #000000, all fine. - swatch_size - 32 to 512, step 8, default 100. Width and color-block height of each swatch.
- show_labels - default on. The label band is where the exact hex lives, and the exact hex is the value a structured prompt consumes, so leave it on unless you're just glancing.
- IMAGE - the strip. Wire it to Preview Image or Save Image. Batch size 1, width =
swatch_size × colors, height =swatch_size(+24 with labels). - COLOR_COUNT - how many colors the parser actually found. This is the genuinely useful output: it's a free assertion that your paste wasn't truncated.
Install
ComfyUI Manager → search ComfyUI-Rennart → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Rennart2025/ComfyUI-Rennart
No model downloads and nothing exotic: the pack's requirements.txt is torch + numpy, and this node only needs those plus Pillow. Its sibling, Palette Extractor, quietly needs scikit-learn on top of what the repo declares - if you installed the pack and only the Preview shows up, that's why, and python -m pip install scikit-learn plus a restart fixes it.
Common issues
You got one gray swatch. Nothing parsed, and COLOR_COUNT will read 1. Check that your hex codes actually have a # in front of them - FF5733 with no hash is not matched by the regex, though a bare ["FF5733"] still renders, labeled without the hash. Watch COLOR_COUNT rather than the image.
It picked up a color you never meant to paste. The regex matches any # + 6 hex digits anywhere in the text, and a lot of innocent strings are valid hex - #deadbe, #123456 inside an ID. Paste a whole paragraph and expect strays.
The labels are microscopic at swatch_size 512. They are: the font is loaded at a fixed 15 px and does not scale with the swatch. Big swatches buy you print-friendly blocks with tiny captions. 100 is a sensible default; 200 at most if you want the labels legible.
A 16-color palette at 512 is an 8192 px wide image. Legal, silly, slow to preview. Drop swatch_size to 64–100 for anything you're just inspecting.
Scope, honestly: nothing downstream consumes a swatch strip - it's a viewer and a QA node, so use it to verify a palette before it goes into a prompt, not mid-graph. Just don't expect it to change your renders. ComfyUI-Rennart is a tiny MIT pack by Rennart (Rinat Maksutov), credited to WAS Node Suite and SurrealByDesign's Ideogram palette tools, and it's basically invisible in community discussion - so judge it on the source, which here is about forty lines of regex and Pillow.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| hex_string | STRING | — | |
| swatch_size | INT | 10032–512 | — |
| show_labels | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| COLOR_COUNT | INT | — |