LayerUtility: GetColorTone V2(Advance)
GetColorTone V2 — ComfyUI Node Guide
- image
- mask
- image
- color_in_hex
- HSV color in list
- mask
Sometimes you don't need to change an image, you need to know something about it - specifically, what color it is. GetColorToneV2 pulls a single representative color out of an image (or a specific region of one) and hands it back as both a hex string and an HSV list, which is exactly the kind of small utility node that's easy to overlook until you need color-matching between a generated subject and a background, or you're driving some downstream logic off "what color is this thing" programmatically.
V2's real addition over the original GetColorTone is being able to target which part of the image you're sampling - the original just gave you main-color-or-average-color over the whole frame. This version can isolate the mask, the background, or the subject specifically, which is a meaningfully different question than "what color is this whole picture."
Inputs that decide what you get:
image- your source.mode-main_color(the dominant color, useful for flat or posterized regions) oraverage(the mathematical average across pixels, better for textured or gradient areas).color_of- four options:mask(only the masked region),entire(the whole image),background, orsubject. The last two require background/subject separation to happen internally.remove_bkgd_method- whencolor_ofisbackgroundorsubject, this decides how that separation happens:BiRefNetorRMBG 1.4. Set tononewhen you're usingmaskorentire, since no separation is needed.invert_mask- flips which side of your mask counts, if you're using themaskoption and it's backwards from what you expected.mask_grow- expands or shrinks the mask before sampling; the README notes that forsubjectmode specifically, a larger grow value pulls the sampled color closer to what's at the center of the body, useful if edge pixels are picking up background bleed and skewing your reading.
Outputs: image (a solid-color swatch at the same dimensions as your input, handy for visually checking the result at a glance), color_in_hex (a hex string like #FA3D86), HSV color in list (the same color as an HSV tuple, useful if downstream logic wants HSV math instead of hex), and mask (whatever mask ended up being used for the sample - worth checking if your color result looks off, since it tells you exactly what region got averaged).
Installing it: ComfyUI Manager, search "ComfyUI Layer Style Advance," or git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance into custom_nodes, then install_requirements.bat (or Aki variant) / pip install -r requirements.txt, then repair_dependency.bat, restart. If you're using BiRefNet for background/subject separation, you'll need those model files too - see the README's BiRefNet section, models go into ComfyUI/models/BiRefNet. RMBG 1.4 follows the same general install pattern described for the pack's other background-removal-adjacent nodes.
Where results go wrong: a surprising number of "wrong color" reports trace back to mode rather than the separation logic - main_color and average can give visibly different answers on a busy or textured region, so if the color looks off, try switching modes before assuming the background/subject split failed. And if you're using subject mode and the color feels contaminated by background, raise mask_grow before switching separation methods; it's usually an edge-bleed problem, not a segmentation-quality problem.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mode | COMBO | 2 options: main_color, average | |
| color_of | COMBO | 4 options: mask, entire, background, subject | |
| remove_bkgd_method | COMBO | 3 options: none, BiRefNet, RMBG 1.4 | |
| invert_mask | BOOLEAN | false | — |
| mask_grow | INT | 0-999–999 | — |
| maskopt | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| color_in_hex | STRING | — |
| HSV color in list | LIST | — |
| mask | MASK | — |