Nodes/MdColorMod/Primitive Color RGB (MD)
ComfyUI Node

Primitive Color RGB (MD)

Type RGB values, get an int and a hex code — the color picker nobody thinks to need

By MdONeilsl·Created 2 months ago·Updated 2 months ago· 0
Primitive Color RGB (MD)
    • int
    • HEX
    Red0
    Green0
    Blue0

    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.

    Categorymd/color

    Inputs (3)

    NameTypeDefaultDescription
    RedFLOAT00–255Red component value (0-255).
    GreenFLOAT00–255Green component value (0-255).
    BlueFLOAT00–255Blue component value (0-255).

    Outputs (2)

    NameTypeDescription
    intINTPacked 24-bit integer color value (0-16777215).
    HEXSTRINGHexadecimal color string (e.g., #FF0000).