Color Code ๐จ
A Color Picker That Speaks Hex, RGB, and RGBA
- hex
- rgb
- rgba
- alpha
Colors in ComfyUI are always a pain to type. Hex, (r,g,b), (r,g,b,a) - every node wants a different format, and eyeballing that a value is "the right red" is hopeless. Color Code is the pack's answer: a color picker widget that outputs the same color in every text format you'd ever need, plus the alpha as a separate float. Pick once, wire the format your downstream node expects, move on.
It's the text-output sibling of the pack's Color Image node (which makes an actual image of a color). This one is for when you need the value, not pixels - feeding hex into nodes that take hex strings, RGB into custom-script nodes, or RGBA into something that wants the alpha separately.
How it works
Dead simple: it parses the hex input (handling both #RGB shorthand and full #RRGGBB, and even tolerating a missing #) and then formats it four ways on output:
hex- the normalized#RRGGBBstring.rgb-(r, g, b)with integer 0โ255 values.rgba-(r, g, b, a)including the alpha.alpha- the alpha as a bare FLOAT, ready to wire into a number input.
Invalid input degrades gracefully to red rather than erroring - it's not going to crash your graph over a typo.
The inputs that matter
Just one: color, a hex string (default #FF0000). The widget includes a color picker, so realistically you never type hex at all. There's also a hidden alpha input the node accepts, which defaults to 1.0 - you won't see it on the graph surface unless you need it, but it's what the RGBA and alpha outputs draw from.
Where it slots in
The niche is connecting the color-picker world to the text-based world. Type your material's accent color into Color Code, then feed the rgb string into any node that takes a color argument, the alpha float into an opacity input, and the hex into another hex-expecting node - all guaranteed to agree with each other, which they won't be if you hand-type them. It also doubles as a converter: if some node gave you a color in one format and you need another, run it through here.
Installing it
Ships inside TextureAlchemy:
cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy
restart, and it's under Texture Alchemist โ Color. ComfyUI Manager: search "Texture Alchemy". No extra dependencies.
Gotchas
This node has no image inputs or outputs at all - if you tried to wire an image in, that's the wrong tool (Color Image is the one that makes pixels). Also remember the rgb output is an integer string like (255, 0, 0), not three separate floats - if your downstream node wants a single float per channel, you'll need to split it or use the alpha output as your number example. And the #RGB shorthand expands to #RRGGBB by doubling digits, which is standard CSS behavior - #F00 becomes #FF0000, not something weird.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| color | STRING | #FF0000 | Color in hex format (e.g., #FF0000 for red) |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| hex | STRING | โ |
| rgb | STRING | โ |
| rgba | STRING | โ |
| alpha | FLOAT | โ |