At other times, pealing away the cedar bark reveals a colorful staining, possibly left by a fungus. In this case, it didn't tunnel or break the surface of the wood, leaving only its colorful pattern.
A similar phenomenon is produced by the blue stain fungus, Grosmannia clavigera, which is introduced into pine trees in the west by the mountain pine beetles. This has turned into a major ecological disaster, wiping out massive forests of pine and leaving dead trees and the fire risk they create.
The whole story of the interaction of the mountain pine beetle, Dendroctonus ponderosae, and the blue stain fungus, Grosmannia clavigera, is both complicated and much more interesting than just the blue wood it produces. The fungus is integral to the beetle's success, so much so that the beetle carries it along between trees.
The fungus has developed a symbiotic relationship with the beetle. It is transported in a specialized structure in the beetle's head. Once the beetle bores into the wood, the fungus spores germinate and produce mycelium which fill the phloem and sap wood, the tree's vascular system, plugging it similar to blood clots in our vessels. This not only starves the tree by blocking the flow of nutrients but it also blocks the production of resin which would otherwise inhibit the beetle larvae.
Recent studies have "identified genes in Grosmannia clavigera that are responsible for the fungus's ability to bypass the lodgepole pine's natural fungicide -- and use it as a carbon source for fungal growth." This co-evolution is an interesting mechanism which has led to disastrous consequences in our western pine forests.