Anthocyanins are a class of chemicals found in the leaves, stems, flowers & fruits of a variety of plants. These include cherries, blueberries, cranberries and blackberries.
The role such chemicals play in plants is quite varied. One of the most important roles is of course reproduction. Brightly colored flowers attract pollinators such as bees & humming birds while colored fruits signal food sources. This in turn contributes to seed dispersion.
Primates such as humans, apes & monkeys are unique among mammals in having superior color vision. The evolution of this trait may in part be related to being able to find fruit among all the green leaves.