ComfyUI Node

Color/Gradient Image

The color/gradient node nobody thinks to install — until they need a background

By orion4d·Created about a year ago·Updated about a year ago· 3
Color/Gradient Image
    • IMAGE
    width512
    height512
    modesolid
    color1#ffffff
    color2#000000
    angle0.0

    The ColorImageNode makes a solid color or a gradient image at whatever resolution you ask for. That's it. It's the most boring node in this pack, and also the one I reach for constantly, because ComfyUI has no built-in "make me a plain 512×512 background" node worth using. When you need a blank canvas, a gradient backplate, or a flat color to tile behind something, this is a two-second fix instead of a detour through an image editor.

    How it works

    Pure numpy math, no models, no filters. It builds an H×W×3 float image in the standard ComfyUI range (0–1) and drives the pixel values off the mode you pick:

    • solid - fills everything with color1.
    • linear - a straight gradient between color1 and color2, whose direction rotates with angle.
    • radial - color1 in the center bleeding out to color2 at the edges.
    • angular - a sweep/cone gradient like a color wheel section, rotated by angle.
    • mirror - a linear gradient that bounces back instead of ending.
    • diamond - the radial-gradient-in-a-suit gradient, nice for subtle vignette-ish backdrops.

    Colors are hex strings, exactly like #ffffff / #000000, and angle is degrees from 0 to 360.

    The inputs that matter

    • width / height (default 512 each, range 16–4096): output resolution.
    • mode (default solid): one of the six above.
    • color1 / color2 (default #ffffff / #000000): the two ends.
    • angle (default 0, step 0.1): rotates linear, angular, and mirror gradients.

    One IMAGE output. Where does it actually get used? Solid-color images are quietly useful as img2img starting points when you want a clean denoise from nothing, as inpainting region fills, or as placeholders while you build a workflow. A linear gradient is the classic soft backdrop for product-style generations, and if you feed a gradient into the pack's autostereogram node as a pattern you can see the depth effect working in slow motion.

    Install

    Part of orion4d/illusion_node ("ComfyUI Illusion & Pattern Nodes"), found under the "illusion" category. ComfyUI Manager search "Illusion" works, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/orion4d/illusion_node.git
    

    Restart after cloning. The pack's requirements are numpy, torch, and Pillow - already present in any working ComfyUI, so this installs with zero friction and pulls no model files.

    Common issues

    Not many, honestly - this one is small and does what it says. The two traps: an unparseable hex string will throw, so keep the # and the six digits (the node is not forgiving about rgb() or named colors), and remember that angle is meaningless in solid and radial modes, which trips up people who set it once and never look back. If you're using gradients as actual lighting cues in a final image rather than as a workflow utility, the in-graph math is limited compared to a proper lighting pack - but as a background generator it's hard to beat for zero dependencies.

    Categoryillusion

    Inputs (6)

    NameTypeDefaultDescription
    widthINT51216–4096
    heightINT51216–4096
    modeCOMBOsolid6 options: solid, linear, radial, angular, mirror, diamond
    color1STRING#ffffff
    color2STRING#000000
    angleFLOAT0.00–360

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE