Nodes/Comfyui-PixNodes/Color Picker (PixNodes)
ComfyUI Node

Color Picker (PixNodes)

One color in, six different formats out

By pixixai·Created 8 months ago·Updated 5 months ago· 23
Color Picker (PixNodes)
    • Output
    modeRGB
    output_formatRGB (List)
    red255
    green255
    blue255

    Every workflow needs a color somewhere - a background for an outpainting canvas, a solid fill for a mask, a tint for a gradient. ComfyUI core's answer is "type the hex value into a string widget and hope the downstream node parses it." Pix_ColorPicker is the friendlier version: pick a color, choose an output format, and get exactly the shape of data your next node wants. The hook is in the output_format menu - this one node covers six different downstream needs.

    The inputs are mode (RGB or HSV), output_format, and three integer sliders red, green, blue. The slider ranges are worth a second look: all three go 0–360 even in RGB mode, because in HSV mode they're repurposed as hue (0–360), saturation (0–100), and value (0–100). So you dial the numbers in one coordinate system and the node converts internally - RGB to HSV via Python's colorsys, or HSV to RGB. Pick your input mode, then pick what comes out:

    • RGB (List) - [r, g, b] as 0–255 ints, for nodes that want a color triplet.
    • HSV (List) - [h, s, v] as H 0–360, S/V 0–100, if the consumer thinks in hue.
    • Hex (String) - #RRGGBB, the format string-heavy nodes (like PixNodes' own bg_color widgets) expect.
    • Decimal (Int) - the 24-bit packed integer ((r << 16) | (g << 8) | b), for API payloads that want one number.
    • Image (Tensor) - a [1, 1, 1, 3] tensor, a solid-color image you can pipe into compositing nodes.
    • Brightness (Float) - just the V channel, 0.0–1.0, handy as a generic 0–1 dial.

    The single output is a wildcard * whose actual type changes with output_format - the frontend JavaScript swaps the socket type on the fly. That's the clever bit and also the thing to watch: the socket's declared type updates so ComfyUI validates the connection, but the actual Python object is whatever the format says. Pick the format first, then wire - if you change the format after wiring, the connection may silently mismatch what's really flowing.

    Why it's useful beyond convenience: consistency. A Hex (String) output from this node is a normalized #RRGGBB, which dodges the "my hex string had a space / no hash / wrong case and the parse failed" class of bugs that the ImageBatchCompose color parser (with its surprisingly long format-negotiation list) exists to survive. When you need a known-good color, generate it here rather than typing.

    Install is the standard PixNodes route - ComfyUI Manager, search PixNodes, restart - or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/pixixai/Comfyui-PixNodes
    cd Comfyui-PixNodes
    pip install -r requirements.txt
    

    then restart. Deps are just openai and Requests; the node itself is pure Python plus colorsys, so there's nothing to break.

    One thing that's easy to miss: the RGB sliders cap at 360 but the code clamps to 255 in RGB mode, so values above 255 are silently truncated. Don't fight it - if you need a specific color, either stay under 255 or work in HSV mode where the extended ranges mean something.

    CategoryPixNodes

    Inputs (5)

    NameTypeDefaultDescription
    modeCOMBORGB2 options: RGB, HSV
    output_formatCOMBORGB (List)6 options: RGB (List), HSV (List), Hex (String), Decimal (Int), Image (Tensor), Brightness (Float)
    redINT2550–360
    greenINT2550–360
    blueINT2550–360

    Outputs (1)

    NameTypeDescription
    Output*