Primitive Color RGB (MD)
Type RGB values, get an int and a hex code — the color picker nobody thinks to need
- int
- HEX
A lot of ComfyUI nodes want a color as a single packed integer - one number like 16711680 that encodes red, green and blue in one 24-bit value. Manually converting #FF0000 to that number in your head is miserable. mdPrimitiveColorRGB is the two-second fix: three sliders, and out come the packed integer and the #RRGGBB hex string. That's the whole job, and it does it cleanly.
How it works
You set Red, Green and Blue in 0–255. The node clamps each to the valid range, rounds, then packs them as (R << 16) | (G << 8) | B - the standard way color ints are stored in this corner of the ecosystem, and the same scheme MdColorMod's own colorize node uses for its solid-color input. It also emits the matching #RRGGBB string for when you want the human-readable form.
The inputs and outputs
Red/Green/Blue- FLOATs, 0 to 255, default 0. (Yes, floats - you can type 127.5 if you're feeling fancy; it rounds.)- Output
int- the packed 24-bit integer (0 to 16777215). - Output
HEX- the hex string, e.g.#FF0000.
Both outputs are values, not pixels. The int goes into any node with an INT color input; the HEX string goes into text/display or anything that wants a color as a string.
Install
It's part of the MdColorMod pack - no dependencies, no models, just the clone:
cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod
Restart ComfyUI, or grab it through ComfyUI Manager by searching "MdColorMod". All the primitive color nodes live under the md menu.
Where people get burned
The easy miss is treating the int output like an image - it's a number, and if the downstream node expects IMAGE you'll get a type error, not a colorful surprise. Beyond that, it's a boring, dependable utility: values are clamped, so Red at 300 silently becomes 255. If you're picking colors by feel rather than by eyeballing hex codes, the HSV or HSL variants in this same pack are usually friendlier starting points - RGB is the one you reach for when a spec hands you exact values.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| Red | FLOAT | 00–255 | Red component value (0-255). |
| Green | FLOAT | 00–255 | Green component value (0-255). |
| Blue | FLOAT | 00–255 | Blue component value (0-255). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| int | INT | Packed 24-bit integer color value (0-16777215). |
| HEX | STRING | Hexadecimal color string (e.g., #FF0000). |