Nodes/ComfyUI-BadmanNodes/HexGenerator(Badman)
ComfyUI Node

HexGenerator(Badman)

Pack RGB sliders into the color int this pack's other nodes want

By MariusKM·Created 2 years ago·Updated 3 months ago· 4
HexGenerator(Badman)
    • INT
    r0.50
    g0.50
    b0.50
    grayscale

    A small conversion node with an unglamorous job: take three normalized RGB sliders and turn them into a single packed integer representing a hex color. The output type is INT, not a hex string - and that detail matters more than it looks, because it's exactly what pairs this node up with the rest of the pack.

    Why the output is an integer, not a string

    Elsewhere in this pack, the LABColorTransfer node takes its target color as a hex_color field typed INT, not a string field where you'd type #RRGGBB by hand. HexGenerator is the node that produces that value. Instead of memorizing or looking up a hex code and typing it into a text field, you get three 0–1 sliders - genuinely intuitive to drag toward a color by eye - and this node packs them into the integer format the rest of the pack's color tools expect. Think of it as a color picker built out of primitives, feeding a numeric interface rather than a text one.

    Inputs and outputs

    Four required fields:

    • r, g, b (float, 0–1, default 0.5, step 0.01) - the three color channels, normalized rather than the more familiar 0–255 range. 0.5 across all three gives you a mid-gray starting point.
    • grayscale (boolean) - a toggle to output a neutral, grayscale color instead of the RGB combination you dialed in. The schema doesn't document the exact formula it collapses the three channels down to, so if you need a specific gray value, it's worth generating both with the toggle on and off and comparing rather than assuming which channel weighting it uses.

    One output: INT - the packed color value, ready to wire into any Badman node expecting a hex-as-integer input.

    Installing it

    ComfyUI Manager: search ComfyUI-BadmanNodes, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MariusKM/ComfyUI-BadmanNodes
    

    Nothing to download beyond the pack itself - this is a pure numeric conversion, no models, no extra Python packages.

    Where people get tripped up

    The obvious trap: if you're used to entering colors as 0–255 integers or #RRGGBB hex strings, the 0–1 float range here throws people off at first - punch in 255 expecting "full red" and you'll get an error or a value clamped to 1, not the color you meant. Divide your familiar 0–255 value by 255 to get the right slider position (255 → 1.0, 128 → 0.5, and so on). Second, don't assume this node's INT output is interchangeable with a plain string-typed color field elsewhere in ComfyUI - it isn't; it's specifically shaped for this pack's own hex_color-style inputs, and wiring it into a node expecting a #RRGGBB string will fail to connect. If you need a human-readable hex string for something outside this pack, this isn't the node for that job.

    CategoryBadman

    Inputs (4)

    NameTypeDefaultDescription
    rFLOAT0.500–1
    gFLOAT0.500–1
    bFLOAT0.500–1
    grayscaleBOOLEAN

    Outputs (1)

    NameTypeDescription
    INTINT