Sunlight makes plants produce chlorophyll. There is a lot more chlorophyll in plants than carotenoids and anthocyanins, so leaves look green. The chlorophyll is what absorbs sunlight to give the plant the energy it needs to make food out of water and the carbon dioxide in the air. Chlorophyll is hard for a plant to make. A plant only makes it in places where it will do the most good (that is, collect the most sunlight).
