Why are many fungi fruiting bodies spectacular colours? More...
A lot are white or brown, but many are spectacularly coloured - yellow, red, green, blue - why? Colourful pigments have many different functions. These include attraction (for spore dispersal), warning colours to repel consumers (aposematism and mimicry), camouflage to avoid being eaten), and antimicrobial activities - antibiotics. In the case of antibiotics, bright colours might be an unintended effect of useful chemicals. Pigments can also aid in thermoregulation - dark-colored organisms are at an advantage in colder locations. The short version is that in most cases, we don't really know what the pigments are doing.
If you want to learn more, see:
Krah, F.S. (2023) The unresolved ecological and evolutionary role of fungal fruit body coloration. Frontiers in Ecology and Evolution, 11, 1326710.
