Nodes/MdColorMod/Color Map Color Rotate (MD)
ComfyUI Node

Color Map Color Rotate (MD)

Map one color to another cleanly

By MdONeilsl·Created 2 months ago·Updated 2 months ago· 0
Color Map Color Rotate (MD)
  • image
  • mask
  • image
Source_from0.0
Source_to90.0
Source_clockwisefalse
Destination_from0.0
Destination_to90.0
Destination_clockwisefalse
Gray_threshold0.00
ModeChange to this
Hue0.000
Saturation0.000

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.

Categorymd/image/color

Inputs (12)

NameTypeDefaultDescription
imageIMAGEInput image tensor.
Source_fromFLOAT0.00–360Start of the source hue range (degrees).
Source_toFLOAT90.00–360End of the source hue range (degrees).
Source_clockwiseBOOLEANfalseInterpret the source range clockwise.
Destination_fromFLOAT0.00–360Start of the destination hue range (degrees).
Destination_toFLOAT90.00–360End of the destination hue range (degrees).
Destination_clockwiseBOOLEANfalseInterpret the destination range clockwise.
Gray_thresholdFLOAT0.000–1Saturation threshold below which pixels are treated as gray.
ModeCOMBOChange to thisHow to handle gray pixels: replace with target hue/saturation or treat them as in range.
HueFLOAT0.0000–360Target hue for replaced colors.
SaturationFLOAT0.0000–1Target saturation for replaced colors.
maskoptMASKOptional mask to restrict the adjustment area.

Outputs (1)

NameTypeDescription
imageIMAGEThe hue-rotated image.