ComfyUI Node

HEX to HUE Node

Convert a hex color into the hue number other nodes actually want

By AlekPet·Created 3 years ago·Updated 6 days ago· 1,520
HEX to HUE Node
    • string_hex
    • float_hue_degrees
    • float_hue_norm
    • string_hue_degrees
    • string_hue_norm
    color_hex#00ff33

    You pick a color visually - a hex code, #3399FF, whatever - but a lot of image-processing nodes don't take hex directly; they want a hue value in degrees (0–360 around the color wheel) or normalized (-0.5 to 0.5). HexToHueNode is the small utility that bridges the two: feed it a hex string, get back the hue in every format you might need.

    Why you'd reach for it

    The clearest pairing in this pack is ColorsCorrectNode, which has its own hex_color input and a use_color toggle that already does hex-to-hue conversion internally - so you might wonder why this node exists separately at all. The answer is anywhere you need that hue number rather than feeding it straight into ColorsCorrect: driving a different hue-based node entirely, doing math on it with IDENode, logging it, or just wanting to see the numeric hue value for a color you picked visually, independent of whether you're color-correcting anything at all. It's a small conversion utility, not a color-correction tool in its own right.

    How it works

    Standard hex-to-HSV/HSL color math: parse the hex string into RGB, convert to a hue angle on the color wheel, and output that angle in the couple of formats other nodes might expect - plain degrees, normalized to a -0.5 to 0.5 range (matching how some ComfyUI color nodes represent hue), and string versions of both for anywhere a STRING is more convenient than a FLOAT.

    The inputs and outputs that matter

    • color_hex (required, STRING, default #00ff33) - the only input. Standard hex color string.

    Five outputs, all derived from that one input:

    • string_hex - the hex string, passed through (handy if you want to confirm what was actually parsed, or feed the same hex value onward as text).
    • float_hue_degrees - hue as a FLOAT, 0–360.
    • float_hue_norm - hue normalized to roughly -0.5 to 0.5, matching the format some other hue-based nodes expect instead of raw degrees.
    • string_hue_degrees / string_hue_norm - the same two values as STRING, for wiring into text fields, previewing with PreviewTextNode, or anywhere a node wants text rather than a number.

    Having both FLOAT and STRING versions of the same value is the whole point of the five outputs - pick whichever type the node downstream actually wants instead of adding a separate type-conversion node.

    How to install it

    Via ComfyUI Manager: search "ComfyUI Custom Nodes AlekPet" and install. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AlekPet/ComfyUI_Custom_Nodes_AlekPet
    

    Restart ComfyUI. Pure math, no dependencies to speak of, no model downloads - this runs instantly.

    Common issues & troubleshooting

    Not sure which output to use - degrees or normalized? Check what the downstream node's own hue input expects. ColorsCorrectNode's hue_degrees field, for instance, wants the 0–360 degree range, so float_hue_degrees is the match there; other nodes in the wider ComfyUI ecosystem use the -0.5 to 0.5 normalized convention instead, which is exactly why this node bothers outputting both.

    Getting a type-mismatch error wiring this into a text field. You grabbed one of the FLOAT outputs (float_hue_degrees / float_hue_norm) where a STRING was expected, or vice versa - swap to the matching string_* or float_* output rather than adding a separate conversion node; this node already computed both.

    Invalid hex string. Make sure color_hex is a proper hex color (#RRGGBB format, the # included per the default #00ff33) - malformed hex is the most likely cause of unexpected or zeroed output here.

    CategoryAlekPet Nodes/extras

    Inputs (1)

    NameTypeDefaultDescription
    color_hexSTRING#00ff33

    Outputs (5)

    NameTypeDescription
    string_hexSTRING
    float_hue_degreesFLOAT
    float_hue_normFLOAT
    string_hue_degreesSTRING
    string_hue_normSTRING