They can absorb light energy of specific wavelengths. The light that we see can be split roughly into 7 regions seen during a rainbow. Violet, Indigo, Blue, Green, Yellow, Orange and Red. So each pigment can absorb one of these regions.

Light energy gives 1 photon to the pigment which behaves like an antenna, which is transfered to other structures, which directs the energy towards production of ATP(transfer of energy in living cells is done with ATP)