💀Image Palette Contrary
The main color plus its maximum-contrast opposite
- image
- preview_image
- color1
- color2
The other palette nodes tell you what colors are in the image. 💀Image Palette Contrary from the S4Tool-Image pack asks a weirder question: what's the main color, and what color would stand out against it the most? It returns two colors - the dominant one via K-Means, and a second one chosen for maximum brightness contrast - which is exactly the pair you want when something needs to pop against something else.
That contrast framing is the whole idea. The author's docstring is blunt about the mechanism: extract the main color with K-Means, then find the color with maximum brightness contrast against it. You get a foreground/background pair rather than a palette - think "accent color against a brand color" or "text color against a panel color." The three strength sliders let you push both colors' intensity and the overall saturation, which nudges the pair from natural to punchy.
Inputs and output
image- the IMAGE to analyze.color1_strength(−1 to +1, default 0) - per the tooltip: positive makes bright colors brighter and dark colors darker; negative reverses it. Think "emphasize the contrast relationship."color2_strength(−1 to +1, default 0) - same treatment applied to the second (contrary) color.contrast(−1 to +1, default 0) - the tooltip frames it as saturation control: positive increases saturation, negative desaturates. For a punchier pair, push this positive.
Outputs: preview_image (a two-block strip so you can see the pairing) plus color1 and color2 as STRING hex values - main color and its contrast opposite.
Install
Same pack:
cd ComfyUI/custom_nodes/
git clone https://github.com/S4MUEL-404/ComfyUI-S4Tool-Image.git
pip install -r ComfyUI-S4Tool-Image/requirements.txt
Or ComfyUI Manager → search "S4Tool-Image" → Install → restart. No models - K-Means comes from scikit-learn in the pack requirements.
Gotchas
- K-Means only, no algorithm picker - unlike the other palette nodes there's no
algorithminput; the main color is always the K-Means result. If you need a different extraction strategy, use the other palette nodes. - "Contrast" is brightness contrast - this node opposes by luminance, not complementary hue. If you want actual complementary colors on the color wheel, this won't give you that.
- Defaults are all-zero adjustments - the sliders start neutral, so the first run returns the raw pair. Dial them in for the punchy version.
It's the specialist of the color family - one specific job (a main color and its contrast mate) done well, with the adjustments to tune it for text-on-color or accent-on-color design work.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| color1_strength | FLOAT | 0.0-1–1 | Adjust color1 intensity: positive makes bright colors brighter/dark colors darker, negative reverses |
| color2_strength | FLOAT | 0.0-1–1 | Adjust color2 intensity: positive makes bright colors brighter/dark colors darker, negative reverses |
| contrast | FLOAT | 0.0-1–1 | Adjust color saturation: positive increases saturation, negative decreases saturation |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| preview_image | IMAGE | — |
| color1 | STRING | — |
| color2 | STRING | — |