Why do fruits change colour?
Unripe fruits are green because of chlorophyll in their cells, and the development of different colours during ripening is due to the disappearance of these pigments and the synthesis of carotenoids. Anthocyanins also make a contribution to colours in some ripe fruits and vegetables.
As they ripen, the chlorophyll breaks down and is replaced by orange carotenoids and red anthocyanins. These compounds are antioxidants that prevent the fruit from spoiling too quickly in the air. Fruit-eating animals have also evolved to use the colour change as a sign of ripeness and this helps the plant too, since they need animals to eat the fruit to distribute their seeds.
Exactly how ethylene facilitates ripening is still an ongoing area of research, but, in a nutshell, receptors in the plant end up binding to the ethylene. This triggers certain genes to turn off and others to turn on, resulting in the creation of various enzymes that facilitate the ripening process, such as amylases, which converts the starch to simple sugars, and pectinases, which breaks down the cell walls of the fruit, softening it to make the inside more accessible.
While the enticing innards are being sweetened and made easier to access, the chlorophyll is broken down via hydrolytic enzymes, ultimately removing the green color. As this is happening some pigments are getting synthesized while others that were there all along, but masked by the chlorophyll, are revealed.
The two primary culprits producing the colors here are carotenoids, which are generally responsible for the orange and yellow colors in fruits, and anthocyanins, which are usually responsible for the purples, reds, and blues.
Interestingly, in those regions where fruit eating birds were less common, multi-colored fruits proliferated, and subsequent studies showed that birds were more likely to remove a fruit with more than one color than a mono-colored fruit.
Similarly, in at least one study, scientists found that multi- and brighter- colored ripe fruits were more common in the understory (to be visible in the low light), while duller colors were found higher up (where it is easier for a fruit to be noticed).