Vegetables and colours
An object is coloured because of the light that it reflects. White light from the sun contains all the wavelengths, but when it impacts on an object some of its wavelenghts are absorbed and some reflected. When we see an object of a certain colour, it's because it's reflecting more of that particular wavelength. For example red objects reflect 'red' light, which is light with a long wavelength.
Many vegetables and fruits are strongly coloured because they contain an especial kind of chemical compounds named carotenoids. These compounds have an area called choromophore, which absorbs and gives off particular wavelengths of light, generating the colour that we then perceive.
The chromophore is formed by a sequence of linear carbon-carbon double bonds (represented as C=C), much stronger than simple bonds (represented as C-C), so the atoms remain closer to each other. In general, it's necessary at least seven linear conjugated double bonds for a carotenoid to produce a colour. Besides, the bigger the number of bonds conjugated, the bigger the wavelength of the light absorbed and also the more red the vegetable, as you can see in this light spectrum:
The tomato is red because of the carotenoid lycopene, which contains 11 conjugated carbon-carbon double bonds. You can count these bonds in the picture below, they are selected in red (the atom carbons are omitted, only the bonds are shown). This compound is generated by the plant to protect itself from the air oxidation. So it's a good antioxidant useful for us too, protecting our cells against the action of free radicals (potent oxidants), which are one of the main responsibles of cardiovascular diseases, cancer and aging.
The pigment present in carrots is the betacarotene, with 9 linear conjugated double bonds, less than in lycopene so they are no red but orange (smaller wavelength than red, check it in the spectrum picture). This compound is also a potent antioxidant and besides it's transformed in our body into vitamin A, very important for the maintenance of healthy skin, good vision and a robust inmune system.
Spinachs, parsley and plants in general are green because they contain chlorophyll, a pigment which enables the plant to carry on photosynthesis, transforming solar energy and carbon dioxide into chemical energy in the form of carbohydrates and oxygen. This is a process essential for life.
As you can see in the picture below, the structure of chlorophyll is very complicated, so let's simpy say that it contains a big ring with a magnesium atom in the center. Curiously, the structure of hemoglobine (the carrier of oxygen in our blood) is pretty similar to chlorophyll, though it has an atom of iron instead of magnesium in its center.
The chlorophyll masks the other colours in vegetables and as its amount decreases the rest of colours become evident. This explains for example why tomatoes are initially green and then become red when they ripen.
This is an example of how Chemistry is everywhere, sometimes more evident, and sometimes much less.