Pixel Grid: HEX to Color Names
Stop reading #123456 and start saying 'Muted Deep Blue'
- color_names
Sooner or later in this pack you end up holding a palette: six, twelve, thirty-two comma-separated hex codes staring at you from a string output. The pack gives you two ways to deal with that. Palette to Image shows you the colours as swatches; this node tells you what to call them.
It's the least glamorous node in the collection, and an easy one to forget exists until you want a sprite's colours in a prompt. "A character in muted deep blue and vivid pale rose" is prompt-shaped. #283252, #F9A9BE is not. That's the job: turn a palette into words you can paste into a prompt, squint at, or reuse as a fixed colour vocabulary across a set of sprites.
How it works
It ships a library of 686 named colours and matches in two steps. An exact hex match returns that entry's name. Anything else - which is most generated colours - gets converted to OKLab alongside every library colour, and you receive the nearest name, ties broken by dataset order. OKLab rather than plain RGB distance is the reason this feels right: RGB distances don't line up with what your eye calls similar.
Input parsing is forgiving about format and not forgiving about errors. Three- or six-digit hex, with or without the hash, whitespace and empty entries ignored - but a single malformed value raises ValueError and takes the workflow down with it. There's no "skip that one" mode.
The output is a comma-joined string of names, deduplicated, in first-occurrence order. Which brings us to the one real gotcha.
Inputs and outputs
One input, one output, nothing to configure.
hex_palette(multiline STRING, defaults to#FF0000, #00FF00, #0000FF) - type or paste hex, or wire it from any of the pack's palette outputs:Analyze Palette,Quantize,Merge Similar Colors, orAutofixer'shex_palette.color_names(STRING) - the names. It's a plain string, so it goes into anything expecting one: a CLIP Text Encode to seed prompt wording, a note node, a text-concat node building a longer prompt, or another node's palette field.
The README's own example:
Input: #FF0000, #00FF00, #123456, #FF0000
Output: Red, Lime, Muted Deep Blue
The gotcha: names get deduped, positions don't survive
Two hex codes that resolve to the same name produce one name. So a 16-colour palette can come back as 14, or as 6 if the artwork is all one hue. And the output is ordered by first occurrence - it is not an aligned list sitting next to your input. Feed it four colours, get three names back, and you can't tell from the output which colour lost its slot.
If you need a colour-by-colour readout, send one hex at a time, or pair this with Palette to Image so the swatch and the name sit side by side. When you're using a palette as prompt vocabulary, the dedupe is the feature: distinct colour impressions instead of four near-duplicates.
These names are descriptive, not official: #123456 becoming "Muted Deep Blue" is honest, but it isn't a Pantone reference. A clean bright colour can also pick up an odd neighbouring label - #36C resolves to "Clear Blue" rather than plain "Blue", the nearest entry the library has.
Install
Same as the rest of the pack, since it's the same pack. ComfyUI Manager → search Pixel Grid Helpers → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/molbal/ComfyUI-PixelGridHelpers.git
Or comfy node install comfyui-pixelgrid-helpers from the ComfyUI root, then refresh the browser. No dependencies beyond torch, which ComfyUI already ships - no pip step, nothing to download. The node is listed in the menu as Pixel Grid: HEX to Color Names, under Pixel Grid Helpers.
Troubleshooting
"Invalid HEX color" kills the run. One entry in the list isn't three or six hex digits - a stray #fff0000, a colour name like Red, a trailing fragment from a bad paste. It only takes one, but the error quotes the offending value, so look at what it names.
Fewer names than colours. Expected - see the dedupe above.
A name that seems off by a shade. It's a nearest-match in OKLab against 686 entries, not a classifier. If a label misleads, pick the swatch yourself and treat the name as a hint.
Nothing appears in the UI. This isn't an output node, so there's no preview - wire color_names somewhere, or watch the string in a note node.
The naming logic is based on Solvioza's Color Name Finder, with the matching reimplemented on top of that library.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| hex_palette | STRING | #FF0000, #00FF00, #0000FF | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| color_names | STRING | — |