Nodes/ComfyUI_StringToHex/Color Name to Hex
ComfyUI Node

Color Name to Hex

'Blue' isn't #0000FF — the node that turns color names into hex

By kasukanra·Created 2 years ago·Updated 2 years ago· 1
Color Name to Hex
    • hex_color
    color_nameblue

    It's a word → hex converter, and that's all

    ColorNameToHex is the entire point of the one-node ComfyUI_StringToHex pack: you type blue, it hands back a #RRGGBB string. No models, no weights, no prompt-engineering magic - just a text port in, a text port out. It exists for the awkward moment where a workflow needs a solid color but you're driving it from natural language instead of a color picker.

    Where does that actually come up? Text-rendering and overlay nodes, solid-fill / empty-image utilities, anything that wants a CSS hex value - all those want #RRGGBB strings, while your input layer (a prompt box, a CSV, a text file you load) is full of words. This node is the bridge. It's glue, and it's honest about it. You wouldn't install this pack for a serious production pipeline; you'd reach for it in a sketch workflow where "make the background salmon" needs to become a color the graph can use. Note it's a plain string output, so you can also feed it into any text port or concatenate it with other strings if you're building colors programmatically.

    How it works, and the surprise hiding in it

    Under the hood it wraps the colorcontroller Python library, which resolves English color names against a large curated names table (Martin Krzywinski's colornames collection - a couple thousand entries, so "hazel" and "salmon" work, not just primaries). Here's the catch the README won't tell you: the library returns a list of hex codes, because one name matches many shades. blue alone maps to a dozen candidates. The node just takes the first match (hex_codes[0]) and moves on.

    So blue gives you #00008B - a genuinely dark blue - not the #0000FF of the classic web palette. The name is not wrong, but it's first-match, and first-match has opinions. If exactness matters, treat this node as a starting point, not a source of truth. (Fun bonus: since the library also accepts hex and RGB strings as input, pasting a hex code into color_name round-trips fine - but at that point you don't need the node.)

    The inputs and outputs that matter

    There's exactly one of each.

    • color_name (STRING, default blue) - one line of text. This is the only thing you set. Case doesn't matter; spelling does.
    • hex_color (STRING) - the output, an uppercase #RRGGBB string ready to wire into any hex-consuming port.

    That's the whole interface. It's a leaf utility; nothing to tune.

    Installing it

    The README is one sentence and the pack has zero models, so install is the boring part - mostly. ComfyUI Manager: search ComfyUI_StringToHex and hit install. Or, by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kudou-reira/ComfyUI_StringToHex
    

    Then restart ComfyUI. Here's the not-boring part: the pack's __init__.py tries to auto-install its dependency (colorcontroller) via pip at startup. And colorcontroller caps at Python < 3.11, drags in matplotlib, pandas, numpy, and a Pillow pinned below 9.0. On a modern ComfyUI Desktop or portable build (Python 3.11/3.12), that auto-install can fail outright with "No matching distribution found" - which means the pack may simply refuse to load on the setup most people have in 2026. On Python 3.10 it installs, but you've just dumped a scientific-computing stack into your node environment, and the old Pillow pin can fight ComfyUI's own newer one. It's a one-line lookup wrapped in a heavyweight dependency; if it loads for you, great, but "it won't start on my fresh ComfyUI" is a real failure mode here, and this is why.

    Where people get burned

    • The wrong shade. blue#00008B, because first-match. Check the output once before you bake it into a workflow.
    • Silent black. Any misspelled or unknown name is caught by the error handler and returns #000000. The console gets an error line; the graph just carries on with black. A typo becomes black, not a crash - easy to miss if you're not watching.
    • Startup failures. If colorcontroller didn't install (see above), the node errors on import and shows up nowhere. Check the console for the pip error.

    One more note: the pyproject inside the repo names a different account (kasukanra) than the GitHub repo it lives under (kudou-reira). Presumably the author renamed their account at some point - harmless, but mildly confusing if you go poking at the registry entry.

    Keep it for throwaway, experimental workflows where a word-sourced hex is good enough. For work where the exact shade matters, type the hex yourself. But as a tiny text→color bridge, it does exactly what it says - when its dependency lets it load.

    Categorycolor

    Inputs (1)

    NameTypeDefaultDescription
    color_nameSTRINGblue

    Outputs (1)

    NameTypeDescription
    hex_colorSTRING