Ranasmurfin often decorates trees in Malaysia. This pigment is rare, one of the few proteins in nature to be blue instead of orange, red, or yellow. Why do you see it in trees? And how is it made?
The Malaysian tree frog, Polypedates leucomystax, has a rather involved mating ritual. A male and a female climb up a tree to produce and fertilize eggs, but first the female produces a blue liquid. It's a bit like egg white, and the male and female whip it up like they're turning egg whites into a meringue. The liquid becomes a foam which protects the eggs and helps them stick to the tree.
Biofoams of this kind are common, but blue biofoams are not. Generally, frogs produce white or orange tinted foams. Very few animals of any kind are able to produce blue proteins, and very few pigments are this stable. While most pigments fade when scientists denature the proteins, ranasmurfin — named "rana" for frogs and "smurfin" for you know what — stands up to heat, salts, acids, and alcohols. When the pigment was separated from the goo, it could be reduced to dark blue crystals, which allowed researchers to look at its structure.
It turns out there aren't that many ways to make blue. The pigment's structure is a deep blue because of a zinc atom forming a bridge between two complicated structures of amino acids. This closely resembles the structure of indophenol, an artificial blue dye with two structures linked by a nitrogen atom. It seems there's a really good structure that makes blue, and humans and nature came to the same conclusion, just in different ways. At least we know why humans make the pigment. There's no clear reason why the Malaysian tree frog paints its nursery blue.