🐳Mask_Color
Color the black part of your mask — yes, really
- mask
- background_image
- image
Here's the thing nobody tells you about 🐳Mask_Color (Mask Color Replace): it colors the black part of the mask, not the white part. Read the node's own description and you'll see it: "replace the mask's black region with a custom color." The white area stays whatever the background is (white by default, or your supplied image); everything that's black in the mask gets painted. It sounds backwards, but it's exactly right for its actual use: taking a mask and painting its background a specific color.
Where that matters: you want a mask-colored preview or matte - e.g., "show me what's outside the selection in red" - or you're building a colored key/fill matte for further compositing. It's also a fast way to sanity-check a mask: paint the black region bright red and you can instantly see the mask's footprint.
How it works
Mechanically it's simple and fast. The node starts with a canvas (a white image if you don't supply one), finds every pixel where the mask value is below threshold (default 0.01 - so essentially the black region), and sets those pixels to the RGB color you chose. The mask's white region keeps the background. One mask in, one colored IMAGE out.
Inputs and output
mask- the MASK you want to visualize/color.red,green,blue- 0–255 ints for the paint color. Default all 0 (black), so set at least one.- Optional
background_image- instead of a white canvas, the result keeps this image in the mask's white region. The node auto-resizes it to the mask's dimensions if needed. - Optional
threshold- the cutoff for "black," default 0.01. For a crisp binary mask you'll never touch it.
Output: image (IMAGE) - the mask-as-colored-image.
The V1/V2 trap
This is the first of two mask-color nodes in the pack, and they work opposite. V1 (this node) colors the black region and keeps white as-is. V2 (MaskColorReplaceAdvanced, 🐳Mask_Color_V2) inverts the mask internally and colors the white/selected region - which is what most people picture when they hear "color the mask." If your colored region comes out as the wrong half, you're using the other version. Neither is wrong; they're complements. Reach for V1 when you want the outside tinted, V2 when you want the selection tinted.
Install
Standard Pond Nodes install:
ComfyUI Manager → search "Pond Nodes" (comfy_Pond_Nodes)
or:
cd ComfyUI/custom_nodes
git clone https://github.com/Pondowner857/comfy_Pond_Nodes
cd comfy_Pond_Nodes
pip install -r requirements.txt
Restart after. This one only needs torch and numpy - nothing heavy, no models. Pack footnote: the README flags a console-spam conflict with comfyui_HiDream-Sampler if you run both.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| red | INT | 00–255 | — |
| green | INT | 00–255 | — |
| blue | INT | 00–255 | — |
| background_imageopt | IMAGE | — | |
| thresholdopt | FLOAT | 0.010–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |