The default method is brightness preserving in the HSB colorspace.
We can compare the recolor result here:
drkGrIm = Image[{{0.2}}, ColorSpace -> "Grayscale", ImageSize -> Medium];
mask = Image[{{1}}, "Bit"];
recolor = ImageRecolor[drkGrIm, mask -> LightGreen];
recolor // ImageData
(* ===> {{{0.176, 0.2, 0.176}}} *)
To the result we would get by replacing the hue and saturation of the gray image with the hue and saturation from LightGreen
.
darkGrayHSBColor = ColorConvert[GrayLevel[0.2], "HSB"];
lightGreenHSBColor = ColorConvert[LightGreen, "HSB"];
darkGrayHSBList = List @@ darkGrayHSBColor;
lightGreenHSBList = List @@ lightGreenHSBColor;
newColorHSB = Hue[Join[lightGreenHSBList[[;; 2]], darkGrayHSBList[[-1 ;;]]]];
ColorConvert[newColorHSB, "RGB"]
(* ===> RGBColor[0.17600000000000002`, 0.2, 0.17600000000000002`] *)
This matches the result from the image.
If we are not doing a complete recolor, but just a partial one, the result can be obtained with Blend
.
lessIntensityMask = Image[{{0.4}}];
blendedRecolor = ImageRecolor[drkGrIm, halfIntensityMask -> LightGreen];
blendedRecolor // ImageData
(* ===> {{{0.1904, 0.2, 0.1904}}} *)
Our less recolored result is:
Blend[{GrayLevel[0.2], newColorHSB }, 0.4]
(* ===> RGBColor[0.1904, 0.2, 0.1904] *)
Note that by using the Method option, you can preserve or change different combinations of hue, saturation, and brightness before blending is done.
ResourceFunction["PrintDefinitions"]@ImageRecolor
- perhaps with enough spelunking you can find some of the details you're looking for. $\endgroup$