Nodes/ComfyUI-WJNodes/Color check Name
ComfyUI Node

Color check Name

Filter segmented color data by how close it is to a target color

By 807502278·Created 2 years ago·Updated 11 months ago· 20
Color check Name
  • Color_data
  • color_value1
  • color_value2
  • Color_data
  • Color_data_exclude
Color_InputTypeRGB0-1
methodRGB_distance
threshold0.010

This node belongs to a specific corner of the ecosystem: color-block segmentation, the kind you get from ADE20K-style scene parsing or SAM2 output, where an image gets reduced to flat blocks of color each standing in for a detected region. WJNodes ships a small toolchain around this - load_color_config and color_segmentation build that color-block data in the first place (both live elsewhere in this pack, outside this batch of articles), and Color_check_Name is one of the two nodes that work on the result once you have it. Segmentation ControlNet itself is a legacy but still-real part of the ecosystem - canny, depth, tile and segmentation conditioning are all still in use even as newer models trail behind on breadth - so if you're doing scene-parsing work at all, tools like this are the connective tissue that make the segmented output actually usable.

How it works

You hand it a Color_data dictionary - the segmented color blocks - plus a target color to compare against, and it splits the data into two buckets: colors that match your target closely enough, and colors that don't. That's it. It's a filter, not a transform: nothing about the colors themselves changes, only which ones end up in which output.

method picks the distance metric: RGB_distance compares colors as raw RGB values, HSV_distance compares them in hue/saturation/value space instead, which tends to be more forgiving of brightness differences when what you actually care about is hue. threshold sets how close counts as a match - small values demand a near-exact match, larger values are more permissive.

The inputs and outputs that matter

  • Color_data (required, DICT) - the segmented color-block data to filter.
  • Color_InputType - tells the node what format your target color value is in: RGB0-1, RGB, HEX, or HSV.
  • method - RGB_distance or HSV_distance.
  • threshold (default 0.01, range 0.001–0.999) - how close a color has to be to count as a match. Small is strict, large is loose.
  • color_value1 (optional, LIST) and color_value2 (optional, a mixed string/number type) - your target color(s) to compare against, in whatever format Color_InputType says.

Two outputs, both Color_data-typed dictionaries: Color_data (the matched subset) and Color_data_exclude (everything that didn't match) - so you can route each downstream separately.

Installing it

Via ComfyUI Manager: search ComfyUI-WJNodes, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git
cd ComfyUI-WJNodes
pip install -r requirements.txt

No extra dependency for this one beyond what the pack already needs.

Common issues & troubleshooting

Nothing matches, or everything matches. Start by checking Color_InputType against how you actually specified your target color - feeding a 0–255 RGB value in when the node's expecting RGB0-1 (0.0–1.0 range) will throw the distance calculation off completely and either match nothing or match everything depending on which way the scale error goes.

Matches feel too strict or too loose. That's threshold, and the useful range is genuinely small - it runs 0.001 to 0.999, so don't be afraid to move it by tenths rather than hundredths if your first attempt matched nothing at all.

Results differ depending on lighting/brightness in the source image. Switch method to HSV_distance. RGB distance treats a darker and lighter version of the same hue as further apart than they perceptually are; HSV separates hue from brightness, which usually matches what people actually mean by "same color."

CategoryWJNode/ImageEdit/Color

Inputs (6)

NameTypeDefaultDescription
Color_dataDICT
Color_InputTypeCOMBORGB0-14 options: RGB0-1, RGB, HEX, HSV
methodCOMBORGB_distance2 options: RGB_distance, HSV_distance
thresholdFLOAT0.0100.001–0.999
color_value1optLIST
color_value2optSTRINT

Outputs (2)

NameTypeDescription
Color_dataDICT
Color_data_excludeDICT