Plants have three main pigment molecules in their leaves. These are chlorophylls, carotenoids, and anthocyanins. Besides the leaves, plants may also have colorful bark.
Most leaves are in various shades of green. This is due to the chlorophylls. The name chlorophyll comes from the Greek words chloros (green) and phyllon (leaf). There are six types of chlorophylls in plants. The two main chlorophylls are chlorophyll a and chlorophyll b.
Chlorophyll a absorbs purple and orange light the most. Chlorophyll b absorbs mostly blue and yellow. Neither one absorbs green, so the leaf looks green because that light is reflected to our eyes instead of being absorbed by the leaf.
Chlorophyll molecules have a ring shape at one end, with a magnesium atom in the center. If you boil a leaf in water, this magnesium atom gets replaced by a hydrogen atom, and the color changes from bright green to the dull color of overcooked broccoli.
Carotenes are the pigments that make the yellows and oranges of corn, squash, and carrots.
Look how long the beta carotene molecule is. It has lots of double bonds (where you see two lines close together) alternating with single bonds (where there is only one line). These bonds between the carbons actually smear together, so that the electrons slosh from one end of the molecule to the other, like water in a bath tub. The longer the molecule, the longer it takes to slosh to the other side. The sloshing electrons reflect light whose wavelength matches the sloshing – a long molecule reflects reds. Shorter groups of alternating double and single bonds, like the ring in chlorophyll, reflect shorter wavelengths of light, in this case green.
Anthocyanins are the third pigment plants use. They also have rings with alternating double and single bonds, and they tend to be smaller, so they reflect blues and violet colors. Grape juice is purple because of anthocyanins.
A fun thing about anthocyanins is that they change their color if you change their acidity. If you add vinegar to grape juice, it turns red.