Asked by: Gargi Phadke, India
Unripe fruits are green because of chlorophyll in their cells. 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.
Subscribe to BBC Focus magazine for fascinating new Q&As every month and follow @sciencefocusQA on Twitter for your daily dose of fun science facts.