Nodes/ComfyUI-Rennart/🎨 Generate Gradient (Rennart)
ComfyUI Node

🎨 Generate Gradient (Rennart)

Hand-write gradients as text and skip the design app

By Rennart2025Β·Created 4 days agoΒ·Updated 4 days agoΒ· 2
🎨 Generate Gradient (Rennart)
    • IMAGE
    β—„width512β–Ί
    β—„height512β–Ί
    β—„directionβ–Ύβ–Ί
    β—„tolerance0β–Ί
    β—„gradient_stops0:255,0,0 25:255,255,255 50:0,255,0 75:0,0,255β–Ί

    Rennart Generate Gradient builds a smooth color gradient image directly inside ComfyUI, with the gradient defined as a plain text list of stops. You type something like 0:255,0,0 for "at position 0, pure red" and the node interpolates between your stops and outputs a ready-to-use IMAGE. If you've ever wanted a custom background, a conditioning reference, or a color ramp to feed into a depth or lighting node and found yourself opening a design app to export one, this is the shortcut that stays inside the graph.

    It's from the ComfyUI-Rennart pack, sitting under Rennart/Image next to its sterner sibling, the Posterize version.

    How it works

    The mechanism is vectorized numpy, not per-pixel Python loops. The node parses your gradient_stops into position β†’ RGB color pairs, builds a position map across the image (0 to 100, horizontal or vertical), then linearly interpolates RGB between adjacent stops. Pixels before the first stop get the first color, pixels after the last get the last color, so the gradient clamps instead of leaving edges black. The output is a float tensor normalized to 0–1, which is exactly what ComfyUI's IMAGE type expects, so it plugs straight into anything that takes an image.

    The tolerance input is the quiet differentiator. Set it to 0 and you get a buttery smooth blend. Crank it up and the channels get quantized - values snap to coarse steps, producing visible banding like an old-school 8-bit poster look. It's a cheap way to get a "retro/gradient banding" aesthetic without any post-processing node, and it's the main reason to pick this node over the Posterize variant if you want the option of slightly banded rather than fully stepped.

    The inputs that matter

    • width / height - 64 to 4096, default 512. Nothing exotic.
    • direction - horizontal or vertical.
    • gradient_stops - the whole show. One stop per line: position:red,green,blue with positions 0–100 and RGB values 0–255. The default is a four-stop demo: red β†’ white β†’ green β†’ blue. You can add as many as you like, and positions don't need to be sorted - the node sorts them for you.
    • tolerance - 0–255, 0 for smooth, higher for banding.

    Output is a single IMAGE tensor. Wire it into a preview, use it as a background, or feed it anywhere a generated image is accepted.

    Install and gotchas

    One install gets the whole pack:

    # ComfyUI Manager: search "ComfyUI-Rennart", or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/Rennart2025/ComfyUI-Rennart
    

    Restart ComfyUI. No models to download; deps are just torch and numpy.

    Syntax is the main place people slip. replace(' ', '') runs on your input before parsing, so spaces are stripped - 0: 255, 0, 0 still works, but it also means you can't use spaces inside a color. Also, if your stop text parses to nothing, the node doesn't crash: it returns a black image (torch.zeros) rather than an error, which is easy to mistake for "everything is broken" if you typo the whole block. And note linspace here includes the endpoints, so the first and last stops behave slightly differently than in the posterize sibling - a detail that only matters if you're comparing outputs across the two.

    CategoryRennart/Image

    Inputs (5)

    NameTypeDefaultDescription
    widthINT51264–4096β€”
    heightINT51264–4096β€”
    directionCOMBO2 options: horizontal, vertical
    toleranceINT00–255β€”
    gradient_stopsSTRING0:255,0,0 25:255,255,255 50:0,255,0 75:0,0,255β€”

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGEβ€”