ZML_取色器
Pick a color once, use it everywhere, or roll a random one
- 颜色代码
Typing #FF6B81 into a text widget works, but it's not a color picker. ZML_ColorPicker (ZML_取色器) is: a real eyedropper-style color widget on the node that spits the hex code out as a string, ready to wire into any node that wants a color. And it has one genuinely useful extra - a toggle that rolls a random hex color every run, which makes it a cheap way to shuffle the palette across a batch.
What it is
A primitive-value node from ComfyUI-ZML-Image's tools section, in the same "turn a value into a wire" family the node-plumbing layer describes. The inputs:
- 颜色代码 (STRING, default
#FFFFFF) - a hex color. The widget is hidden and replaced by an actual color-picker UI on the node, so you click, you pick, you're done. - 随机输出颜色 (BOOLEAN, default false) - flip it and the node ignores what you picked and emits a random color each run.
Output:
- 颜色代码 (STRING) - the hex string, e.g.
#FF0000. Feed it to any node that takes a hex color as input: text watermarks, solid backgrounds, mask nodes, whatever.
How it works
The frontend renders the picker and stores your choice as the widget's string value; the backend just passes it through. The interesting mechanism is 随机输出颜色: the node's IS_CHANGED method returns float("NaN"), which is ComfyUI's documented "always rerun this node" trick - NaN is never equal to anything, even itself, so the engine's cache comparison always fails and the node fires every run. That's exactly what a random generator needs, and it's the same idiom any always-dirty node uses. Random color on, you get a fresh color per run (or per batch item, depending on where it sits).
Install and gotchas
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
or ComfyUI Manager → ComfyUI-ZML-Image, restart.
Two things to know. First, the "always rerun" behavior is a double-edged sword: because this node never caches, everything downstream of it is forced to re-execute every run, even if nothing else changed. If you wire a random color into a long chain, you've quietly disabled caching for that whole branch - the node-plumbing docs flag this exact footgun. Use it where you actually want the shuffle, not everywhere. Second, the color only travels as a string; the node doesn't understand anything but hex, so red or RGB tuples won't work - keep it to #RRGGBB. Chinese-first UI as always (English patch at github.com/zml-w/ZZZ_ZML_English_Patch), one-person pack, no English community. Small node, small risks - just remember the cache poisoning when you leave 随机输出颜色 on.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| 颜色代码 | STRING | #FFFFFF | — |
| 随机输出颜色 | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 颜色代码 | STRING | — |