Nodes/ComfyUI-TeaNodes/RandomColorFill
ComfyUI Node

RandomColorFill

A random background color every run

By TeaCrab·Created 3 years ago·Updated 5 months ago· 5
RandomColorFill
  • image
  • IMAGE
color#7f7f7fff
hue_range0.01
sat_range0.01
val_range0.01

RandomColorFill is ColorFill's chaotic sibling. Same premise - you feed it an image, you get back a solid-color IMAGE at exactly that image's dimensions - but instead of honoring the color you give it, it jitters that color around a little (or a lot) with each run. Batch a few generations and you get a different backdrop every time, without touching anything.

It's part of the small ComfyUI-TeaNodes pack by TeaCrab, MIT-licensed, sitting in the TeaNodes/Input category alongside ColorFill.

How the randomness works

The node converts your base color to HSV, then nudges each component by a random value within the ranges you set - half the range in either direction - before rebuilding the fill. So:

  • hue_range (default 0.005) moves the hue, which is how you get "anywhere in the reds."
  • sat_range (default 0.005) moves saturation, from grey up to vivid.
  • val_range (default 0.005) moves brightness, from near-black up to blown-out.

The defaults are deliberately tiny (0.005 of the 0–1 HSV scale - a whisper of variation), because the whole point is a subtle family of colors, not a wheel-spin. Crank one to 0.5 and it becomes a proper randomizer. Each run prints the exact hex it landed on to the console, so if you see a color you love you can read it off and pin it.

The other thing RandomColorFill does better than ColorFill is parse your color string. It goes through the pack's fuller Color parser, which accepts hex in 1, 2, 3, 4, 6, or 8 digits, plus rgb, hsv, hls, and yiq style strings. The README's "hopefully the color input field works for most color string formats" is about this node, and it mostly does.

When you'd reach for it

  • Background roulette for cutouts. Remove a background, then put the subject on a random-but-family-of-matching backdrop each iteration to see what works.
  • Batch variety. Queue 20 runs, get 20 subtly different backgrounds - handy for testing how much a backdrop colors a final composite.
  • Data-gen. Building training/inspection batches that need background variation at a fixed resolution.

Inputs: image (only for size), color (the base to jitter), and the three ranges. Output: IMAGE.

Where it bites

Remember it never changes the base meaningfully unless you raise a range - people wire it up, see a nearly-identical color, and think it's broken. And like its sibling, if the color string fails to parse the node prints an unhandled-case warning and silently bails on the fill, so when output looks wrong, check the console before the graph.

Installing it

ComfyUI Manager → search ComfyUI-TeaNodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/TeaCrab/ComfyUI-TeaNodes

restart ComfyUI. No models; the pack's only declared dependency is the author's regex_spm helper.

It's niche, and it knows it. But if you've ever wanted "same size, random tasteful color, every queue" with zero typing, this is a one-node answer.

CategoryTeaNodes/Input

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
colorSTRING#7f7f7fff
hue_rangeFLOAT0.01
sat_rangeFLOAT0.01
val_rangeFLOAT0.01

Outputs (1)

NameTypeDescription
IMAGEIMAGE