Light-Tool: Hex to RGB
Turn '#FF8800' into three numbers your graph can actually use
- R
- G
- B
Light-Tool: Hex2RGB converts a hex color code - #FF8800 - into three separate R, G, B integer outputs, each in the 0–255 range the rest of the pack expects. It's a color-format adapter, and it exists because ComfyUI workflows oscillate between two worlds: humans think in hex (#4A90D9), and nodes think in three separate channel values.
You'll hit this the moment you're doing anything color-driven - building solid backgrounds, matching a brand color, driving the color inputs of a compositing node. The pack's own AddBackground and AddBackgroundV2 accept hex directly, so you may not need this for them - but the moment a color has to flow into a node that only takes R/G/B ints, or into a batch where you're computing colors programmatically, Hex2RGB is the adapter.
How it works
Single input, color_hex, defaulting to #FFFFFF. It strips the # and parses the six hex digits as three pairs - FF, 88, 00 → 255, 136, 0. Out come three named INT outputs: R, G, B.
The implementation has a small quirk that's actually a nice safeguard: it special-cases pure black (#000000) and white (#ffffff, case-insensitive) before doing general parsing. It's harmless - you'd get the same answer from the general path - but it means the two most common colors are handled as fast paths. What it doesn't do is validate the format. Feed it #GGGGGG (not valid hex) or a color without the # and it will either misbehave or raise, depending on how unparseable the string is. Keep your input to the strict #RRGGBB shape and you're fine.
Inputs and output
- color_hex - the
#RRGGBBstring. - R, G, B - three INT outputs, ready to wire into color int widgets, the R/G/B inputs on the pack's background nodes (with
use_hexoff), or aRGB2Hex-style round-trip for verification.
Where it fits
The workflow pattern that makes this node click is programmatic color. Say you want a workflow that generates several colored-background variants of a product shot. Hex2RGB splits your hex into channels; a Calculate node tweaks the channels (darken, shift hue); and the pack's background compositor takes the adjusted R/G/B. You've turned "change the backdrop color" into a node network instead of a manual edit.
There's a matching RGB2Hex in the pack for the reverse direction - feed it R/G/B ints, get a hex string back. Together they let color travel in either format across your graph. Neither is glamorous; both are the kind of small utility you reach for more than you'd predict once they're installed.
Install
Standard: ComfyUI Manager → search ComfyUI-Light-Tool, or clone into custom_nodes, pip install -r requirements.txt, restart. It's under ComfyUI-Light-Tool → image → Color. Pure Python string parsing - no dependencies, no models.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| color_hex | STRING | #FFFFFF | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| R | INT | — |
| G | INT | — |
| B | INT | — |