color_OneColor_replace
A lightweight color-replace / chroma-key tool
- image
- IMAGE
color_OneColor_replace finds pixels close to one color and swaps them for another. The default target_color is #09FF00 - a near-pure chroma green - which is a strong tell that the author's first use case in mind was green-screen-style background replacement, though nothing stops you using it for any flat-color swap (turn a red shirt blue, recolor a solid backdrop, and so on). It's under Apt_Preset/image/color_adjust.
For an actual green-screen background swap on a busy image you'd normally reach for a proper chroma-key or segmentation node - this pack has separate segmentation nodes for that job. But for quickly recoloring a flat or near-solid area in a generated image, this is a lot less setup than building a full mask pipeline.
How it works
A threshold-based replace: any pixel within clip_threshold of target_color gets swapped to replace_color. There's no edge feathering built in - this is a simple distance-based match, not a proper key with soft edges.
The inputs and outputs that matter
target_color(hex, default#09FF00) - the color to find.replace_color(hex, default#FF0000) - what it gets swapped to.clip_threshold(0-255, default 10) - how close a pixel needs to be totarget_colorto get swapped. Tight by default, so it only catches near-exact matches out of the box.imagein (optional in the schema, but you'll want one wired),IMAGEout.
How to install it
Through ComfyUI Manager: search "ComfyUI-Apt_Preset", install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
then run install.bat (Windows) or install requirements manually on Linux/Mac, and restart. No model downloads for this node.
Common issues & troubleshooting
Nothing gets replaced. Raise clip_threshold - 10 is tight, and real renders rarely have perfectly flat, uniform color, so a strict tolerance can miss most of the region you're after.
Too much gets replaced, bleeding into areas you wanted kept. Lower clip_threshold back down.
Edges around the swapped area look hard or fringed. Expected - this is a simple threshold-based replace, not a proper key with edge feathering. At low clip_threshold you'll see hard edges; at high thresholds, color fringing where near-matches get caught too.
Want to keep a color instead of replacing it? color_OneColor_keep, the companion node in this pack, desaturates everything except your chosen color instead of swapping it.
IMPORT FAILED on the pack. ComfyUI-Apt_Preset is large and updates often; users have reported import failures after some updates. Reinstall via Manager before assuming it's this node.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| imageopt | IMAGE | — | |
| target_coloropt | STRING | #09FF00 | — |
| replace_coloropt | STRING | #FF0000 | — |
| clip_thresholdopt | INT | 100–255 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |