What it does is, for each color channel in the pixel, it takes the value of the tile and multiplies that as a percentage with the foreground color (All numbers in this post are in hexadecimal). For example, if the color of the pixel is
FF8000 (orange), and the foreground color is
808080 (dark gray), the red value becomes 80 * FF/100 = 7F, the green value becomes 80 * 80/100 = 40, and the blue value becomes 80 * 00/100 = 00, so the pixel is color 7F4000 (dark orange/brown).
Visual example:
This is a square consisting of red, green, and yellow tiles surrounded by a white border.
When colored red, the white (FFFFFF) border's green and blue values are multiplied by the red's values of 00, so only red is left. The same happens to the
yellow (FFFF00) The
red (FF0000) pixels are left as they are. The
green pixels (00FF00) and the color red have no values in common, so they're turned black.
When colored green, the same thing happens, but the red tiles are turned black and all others become green.
One example in which you couls use this is with the Φ (capital phi) character, which is the default tile used for sweet pods (
red, FF0000), bloated tubers (
brown, 808000), and kobold bulbs (
dark gray, 808080).
Blue pixels in the tile would only show up in kobold bulbs, and
green pixels would not appear in sweet pods. Pixels with multiple color values would show up as different colors in each plant. For example, a
cyan (00FFFF) pixel would be black in sweet pods,
dark green (008000) in bloated tubers, and
dark cyan (008080) in kobold bulbs.