Nodes/ComfyUI_LayerStyle_Advance/LayerUtility: GetColorTone V2(Advance)
ComfyUI Node Runs on cloud

LayerUtility: GetColorTone V2(Advance)

GetColorTone V2 — ComfyUI Node Guide

By chflame163·Created 2 years ago·Updated 4 months ago· 696
LayerUtility: GetColorTone V2(Advance)
  • image
  • mask
  • image
  • color_in_hex
  • HSV color in list
  • mask
mode
color_of
remove_bkgd_method
invert_maskfalse
mask_grow0

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) or average (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, or subject. The last two require background/subject separation to happen internally.
  • remove_bkgd_method - when color_of is background or subject, this decides how that separation happens: BiRefNet or RMBG 1.4. Set to none when you're using mask or entire, since no separation is needed.
  • invert_mask - flips which side of your mask counts, if you're using the mask option and it's backwards from what you expected.
  • mask_grow - expands or shrinks the mask before sampling; the README notes that for subject mode 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.

Category😺dzNodes/LayerUtility

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
modeCOMBO2 options: main_color, average
color_ofCOMBO4 options: mask, entire, background, subject
remove_bkgd_methodCOMBO3 options: none, BiRefNet, RMBG 1.4
invert_maskBOOLEANfalse
mask_growINT0-999–999
maskoptMASK

Outputs (4)

NameTypeDescription
imageIMAGE
color_in_hexSTRING
HSV color in listLIST
maskMASK