Shuffle Custom Colors
Turning 'the rust-colored pixels' into a mask
- image
- colors
- MASK
Materials are full of regions you can describe by color before you can describe by geometry. The rust spots on a metal plate, the grime in the crevices, the burned patch on the wood - Shuffle Custom Colors turns "the pixels that are this hex color" into a proper mask. It's a color-picker masquerading as a node, and for texturing it's one of the most useful mask sources in the pack.
How it works
The colors input is an autogrowing list of hex color strings - you add a slot, type #8B4513, add another, done. The node parses them, then measures how close every pixel is to your chosen color. tolerance (0 to 1, default 0.2) decides how far from the target a pixel can be and still count; feather (default 0.1) softens the mask edges so you don't get hard pixel-crisp boundaries. mode picks the distance metric: rgb is raw channel distance, hsv is distance in hue/saturation/value space (better when lighting shifts the brightness but not the hue), and luminance compares brightness only - perfect for "all the dark crevices" masks where the actual color is irrelevant.
The trick parameter is channel_index. You can have up to 50 colors defined, and this integer picks which one builds the mask - 0 for the first, 1 for the second, and so on. It's a connectable input, so you can drive it from an LLM or a logic node to flip between color-based masks in one workflow instead of maintaining a stack of separate mask nodes.
The output
A single MASK, ready to wire into a compositor, a blend, a detail-mixer, or an inpaint crop. This is the node you reach for when you want the mask to follow the material - mask the rust so you can roughen it, mask the metal so you can brighten it - without any segmentation model in the pipeline.
Installing it
Part of amtarr/ComfyUI-TextureAlchemy ("Texture Alchemy" in ComfyUI Manager). Or:
cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy
Restart, then right-click → Add Node → Texture Alchemist → Masks. Pure PyTorch under the hood, no extra dependencies, no models.
Where people get burned
Tolerance is the trap. Set it too low and you get a dotted mask as anti-aliased edges drop out; too high and the mask bleeds into neighboring colors - the classic failure is selecting rust and getting half the metal too, because weathered metal is a gradient between the two. If your material has color gradients, pick the middle of the range you care about and let tolerance + feather cover the rest. And luminance mode will ignore hue entirely, so don't use it when red and blue objects both sit in your image and you only want one.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Image to sample for the mask. | |
| colors | COMFY_AUTOGROW_V3 | — | |
| channel_index | INT | 00–99 | Which color to use for the mask: 0 = first, 1 = second, … (connectable e.g. from LLM). |
| tolerance | FLOAT | 0.200–1 | Color matching tolerance. |
| feather | FLOAT | 0.100–0.5 | Edge softness. |
| mode | COMBO | rgb | Color distance mode. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |