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

Primitive Color HSL (MD)

Hue, saturation, lightness

By MdONeilsl·Created 2 months ago·Updated 2 months ago· 0
Primitive Color HSL (MD)
    • int
    • HEX
    Hue0.0
    Saturation0.0
    Lightness0.0

    If HSV is the picker for "how bright," HSL is the one for "how light." Same family of sliders, one meaningful difference: Lightness is a symmetric measure - 0 is black, 100 is white, and 50 is the "full" color. That makes it the friendlier model for design work, where you think in "that blue, but a shade lighter." mdPrimitiveColorHSL converts those three values into a packed 24-bit integer color and its #RRGGBB hex string, ready for any color-INT socket.

    How it works

    Hue (0–360°), Saturation (0–100%) and Lightness (0–100%) go through the standard HSL→RGB conversion, then get clamped and packed as (R << 16) | (G << 8) | B. Same output contract as the other primitive color nodes in the pack: an int for machines, a HEX string for humans. Everything out of range is silently clamped.

    The inputs and outputs

    • Hue - 0 to 360 degrees.
    • Saturation - 0 to 100%.
    • Lightness - 0 to 100%. 0 = black, 50 = pure color, 100 = white.
    • Output int - packed color integer (0–16777215).
    • Output HEX - hex string, e.g. #FF8000.

    Install

    Standard MdColorMod - no dependencies, no models:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod
    

    Restart ComfyUI, or install via ComfyUI Manager by searching "MdColorMod".

    HSL vs HSV, quickly

    The difference is only in how "lightness" behaves near the ends. At Saturation 100 and Lightness 50 you get the vivid color; push Lightness toward 100 and it fades to white while keeping the same hue. HSV's Value, by contrast, pushes toward black at 0 and desaturates. So if you've been fighting the HSV node to get a "pastel" version of a color, HSL does it in one slider. That's the whole reason both exist in this pack. The outputs are plain values - keep the int pointed at color-INT inputs and the HEX at whatever displays text.

    Categorymd/color

    Inputs (3)

    NameTypeDefaultDescription
    HueFLOAT0.00–360Hue value in degrees (0-360).
    SaturationFLOAT0.00–100Saturation percentage (0-100%).
    LightnessFLOAT0.00–100Lightness percentage (0-100%).

    Outputs (2)

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