Convert HEX To RGB
The tiny converter that turns '#FF5733' into numbers other nodes can eat
- R
- G
- B
- RGB
Here's a small irony about comfyui-custom-node-color: its headline feature is recoloring the nodes themselves, which is pure cosmetics. ConvertHEXToRGB is the part of the pack that actually does work inside a generation graph. It takes a hex string and splits it into the red, green, and blue channels as plain integers, plus a formatted string version. If you've ever needed to feed a color into a node that wants R, G, B as separate numbers instead of #RRGGBB, this is the bridge.
It's a genuinely thin utility, and that's the point. You don't want to hand-roll hex parsing in a Workflow Value node when a purpose-built one already validates and normalizes for you.
How it works
The conversion logic is short enough to read in full on the repo:
hex_color = (hex_color or "#000000").replace("#", "").strip()
if not hex_color or len(hex_color) < 6:
hex_color = "000000"
hex_color = hex_color[:6].upper()
r = int(hex_color[0:2], 16)
g = int(hex_color[2:4], 16)
b = int(hex_color[4:6], 16)
Strip the #, pad to six characters with zeros, then read each two-character pair as base-16. If the input is garbage - non-hex characters, too short, an actual ValueError - the whole thing collapses to 0, 0, 0 (black) instead of erroring out the workflow. "Fail to black, not fail to crash" is a reasonable trade for a utility node, but it means you should check your source if the color suddenly looks wrong.
Inputs and outputs
One input, four outputs:
- hex_color (STRING, default
#000000) - accepts#FF5733orFF5733, with or without the hash. - R (INT), G (INT), B (INT) - each channel as
0–255. - RGB (STRING) - the formatted
"255, 87, 51"version, handy when something downstream wants a comma-separated triplet rather than three wires.
Pair it with the same pack's HexColorInput and you get an editable color source feeding numeric channels anywhere they're needed - gradient ramps, solid-color backgrounds, anything that takes per-channel ints.
Installing it
It ships in the same pack as Hex Color Input, so the install is identical:
cd ComfyUI/custom_nodes/
git clone https://github.com/lovelybbq/comfyui-custom-node-color.git
Restart ComfyUI, or search "Custom Node Color" in ComfyUI Manager. No extra dependencies, no model files - the whole pack is JS plus two tiny python classes.
Where people get burned
The one real trap: the converter truncates to the first six characters. Eight-digit hex like #FF5733AA (which some tools use for RGBA with alpha) silently becomes #FF5733, and the alpha is just gone - no warning. You also won't get an error for junk input, just black. So before you assume a color is broken, remember this node leans toward silently normalizing rather than complaining. Check your hex, and if you need alpha, this isn't the node for it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| hex_color | STRING | #000000 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| R | INT | — |
| G | INT | — |
| B | INT | — |
| RGB | STRING | — |