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

LayerUtility: GetColorTone(Advance)

GetColorTone — pull a single representative color out of an image

By chflame163·Created 2 years ago·Updated 4 months ago· 698
LayerUtility: GetColorTone(Advance)
  • image
  • RGB color in HEX
  • HSV color in list
mode

A small, cheap utility node: feed it an image, get a single color back out, described two ways at once - a hex string and an HSV value. No model, no GPU load worth mentioning, no API key. You'd reach for this any time a later step in your graph needs to know what color an image is, not just look right - matching a background color to a reference photo, driving a palette-based prompt, tagging a batch of generations by dominant hue, that kind of thing.

How it works

mode picks between two genuinely different calculations, and picking the wrong one is the main way this node surprises people. average does exactly what it sounds like: the arithmetic mean of every pixel. That's fine for a flat-colored background, but on a busy, multi-colored image an average tends toward a muddy, desaturated grey-brown - averaging a lot of different hues together washes out the color, it doesn't find "the" color. main_color is doing something closer to dominant-color extraction rather than a flat mean, so on the same busy image expect a more saturated, more visually representative answer, closer to what a person would point at and call "the color of this picture."

The inputs and outputs that matter

  • image - the source image.
  • mode - main_color or average, per the above.

Two outputs: RGB color in HEX (a string like #FA3D86) and HSV color in list (Python list format) - pick whichever format the next node in your chain actually needs.

How to install it

Recommended: ComfyUI Manager, search "ComfyUI Layer Style Advance". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance.git

Then install_requirements.bat / install_requirements_aki.bat, or pip install -r requirements.txt plus repair_dependency.bat. Restart. No model download for this node - it's plain pixel math.

Common issues & troubleshooting

The color doesn't match what you expected. Nine times out of ten this is a mode mismatch, not a bug - if you wanted "the dominant color a person would name," you wanted main_color, not average. Switch modes before assuming anything's broken.

You need color from just part of the image - a mask region, the subject only, or the background only. This node doesn't have a mask input in its schema; it always works on the full frame. That's specifically what GetColorToneV2 exists to add - it takes color_of (mask / entire / background / subject) plus a background-removal method, so if per-region color extraction is what you actually need, that's the node to reach for instead.

Fine detail in the returned HSV list looks off for what should be a simple flat color. Compression artifacts, subtle gradients, or anti-aliased edges in the source image all nudge an "average" reading slightly - if you need an exact, deterministic color and the source is meant to be flat, sample it with a plain image editor's eyedropper as a sanity check rather than assuming the node made an error.

Category😺dzNodes/LayerUtility

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
modeCOMBO2 options: main_color, average

Outputs (2)

NameTypeDescription
RGB color in HEXSTRING
HSV color in listLIST