Color Map Color Rotate (MD)
Map one color to another cleanly
- image
- mask
- image
If the color exchange node is "recolor this color," mdColorMapColorRotate is "rotate this range of colors into that range." It's the GIMP-style color rotate operation, and it's the node you reach for when you want to move a whole family of hues - "all the greens become teal" - rather than one specific RGB value.
How it works
The image is converted to HSV, and pixels whose hue falls inside a source range get their hue remapped into a destination range, keeping the pixel's position within the range. Because it's a range-to-range mapping, smooth gradients survive - a sky that fades from cyan to blue stays a smooth fade after you rotate it to teal-to-purple, instead of developing hard band edges. Two extra mechanisms handle the edge cases real images have:
- Gray_threshold - a saturation cutoff. Below it, pixels are treated as gray (hue is meaningless there) and routed through the Mode setting: Change to this recolors grays to your target hue/saturation, Treat as this leaves them alone. The first mode is how you do full stylization; the second is how you keep neutrals neutral.
- Hue / Saturation - the target color used in Change-to-this mode.
The inputs that matter
- Source_from / Source_to (0-360) - the hue range you're grabbing.
- Source_clockwise - which way around the wheel the range runs. Essential when your range crosses the 0/360 wrap (e.g. a range from 350 to 10).
- Destination_from / Destination_to (0-360) - where they land.
- Destination_clockwise - same wrap control on the output side.
- Gray_threshold, Mode, Hue, Saturation - the gray-handling trio above.
- image in, image out, optional mask.
The workflow answer it provides
This is the "sunset shift" node: take a daytime scene, grab the blues and rotate them toward orange, and the sky reads as golden hour while the rest of the frame barely moves. It's also the systematic version of a hue rotation for palette experimentation - flip a render's accent colors to test alternate palettes in seconds, which is far cheaper than a re-gen. Like the rest of the MdColorMod pack it's deterministic, instant, maskable, and alpha-preserving. One honest caveat: hue-based selection is global, so "greens" includes every green in the frame - foliage and a green shirt. That's where the mask input earns its keep.
Installing
Standard MdColorMod setup:
cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod
or ComfyUI Manager → "MdColorMod", restart. Empty requirements.txt, pure torch, no model downloads, GPL-3.0. New pack, thin online footprint - if Manager can't find it, clone manually and refresh.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image tensor. | |
| Source_from | FLOAT | 0.00–360 | Start of the source hue range (degrees). |
| Source_to | FLOAT | 90.00–360 | End of the source hue range (degrees). |
| Source_clockwise | BOOLEAN | false | Interpret the source range clockwise. |
| Destination_from | FLOAT | 0.00–360 | Start of the destination hue range (degrees). |
| Destination_to | FLOAT | 90.00–360 | End of the destination hue range (degrees). |
| Destination_clockwise | BOOLEAN | false | Interpret the destination range clockwise. |
| Gray_threshold | FLOAT | 0.000–1 | Saturation threshold below which pixels are treated as gray. |
| Mode | COMBO | Change to this | How to handle gray pixels: replace with target hue/saturation or treat them as in range. |
| Hue | FLOAT | 0.0000–360 | Target hue for replaced colors. |
| Saturation | FLOAT | 0.0000–1 | Target saturation for replaced colors. |
| maskopt | MASK | Optional mask to restrict the adjustment area. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The hue-rotated image. |