color_TransforTool
Converting between hex and RGB(A) without leaving the graph
- hex_str
- R
- G
- B
- A
This one's not glamorous, but it solves an annoyingly common problem: half the nodes in ComfyUI want a color as a hex string, the other half want it as separate R/G/B/A numbers, and you're constantly hand-converting between them or googling a hex-to-RGB calculator mid-workflow. color_TransforTool is a small converter node that sits in the middle and speaks both dialects at once.
What it is and why you'd reach for it
ComfyUI-Apt_Preset, from cardenluo, is a big all-in-one pack built around simplifying dense workflows - a "Loader → Controller → Sampler" framework up top, and a long tail of image/mask/data utility nodes underneath. color_TransforTool lives in that utility tail, filed under image color-adjust tools. There's no modidex panel for this pack specifically yet (see the gap note below), but the README's own changelog shows it's actively maintained - new nodes landing as recently as this spring.
The job here is narrow on purpose: give it a color, get every common representation of it back out in one shot.
How it works
You've got two ways in. Set color - a hex-string field with a #000000 default, almost certainly rendered as a color-picker swatch in the ComfyUI graph - and pick your color visually. Or skip the picker and wire in the numeric pieces directly: r, g, b (0–255 each) and a (0–1), or hand it a raw hex_str if you've already got one from somewhere else in the graph. Either path resolves to the same set of outputs, so it works equally well as "I want to click a swatch" or "I already have RGB values from another node and need a hex string out the other end."
One thing worth knowing up front: the schema exposes two alpha-ish fields - alpha (0–1, step 0.01, tied to the picker) and a separate a (0–1) in the override group. That's not a typo you're misreading, the node genuinely has both. If your alpha isn't doing what you expect, check you're feeding the one you think you are.
Inputs and outputs that matter
color(required) - the hex color, default#000000. This is the one you'll touch most; it's the picker widget.hex_str,r,g,b,a(optional) - override/build-from-numbers path. Use these when you're constructing a color from math elsewhere in the graph instead of picking it by eye.
Outputs: hex_str, R, G, B, A - the same color, five ways. Wire whichever one downstream actually asks for: a text-overlay node that wants #RRGGBB, an image-compositing node that wants individual int channels, whatever.
Installing it
Through ComfyUI Manager: search ComfyUI-Apt_Preset (or just "Apt_Preset"), install, restart. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Then, per the README, double-click install.bat to pull in the pack's dependencies before restarting - note that's a Windows batch script; on Linux or Mac you'll need to open the repo folder and install its Python requirements by hand instead, since there's no equivalent script shipped. This node itself needs no model downloads - it's pure Python color math.
Common issues
The pack is large and actively developed, and that combination has a real-world cost: at least one user on r/comfyui has reported ComfyUI-Apt_Preset failing to import outright at startup ("IMPORT FAILED") after installing via git or the Manager. That's the classic large-pack dependency problem - a Python requirement didn't get installed, usually because install.bat was skipped or isn't available on the platform. If any Apt_Preset node, including this one, is missing or red in your graph, check the ComfyUI console log on startup for the actual import error rather than guessing - it'll name the missing package.
Beyond that, this node has no real failure modes of its own: it doesn't touch the network, doesn't load a model, and the math is deterministic. If the outputs look wrong, it's almost always that you're feeding a numeric override field you didn't mean to.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| color | STRING | #000000 | — |
| alphaopt | FLOAT | 1.000–1 | — |
| hex_stropt | STRING | — | |
| ropt | INT | 0–255 | — |
| gopt | INT | 0–255 | — |
| bopt | INT | 0–255 | — |
| aopt | FLOAT | 0–1 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| hex_str | STRING | — |
| R | INT | — |
| G | INT | — |
| B | INT | — |
| A | FLOAT | — |