When an object absorbs all wavelengths to a great extent, it appears black. If it largely reflects all light, it appears white. Objects that absorb only a fraction of all the wavelengths appear colored. Light falling on an object is somewhat like rain falling on the ground. During a thunderstorm, some raindrops are quickly absorbed into the earth, but others hit so hard and fast they bounce off the ground.
Different materials absorb different wavelengths of light.
Things that absorb light in the visible spectrum are called pigments. The chemical structure of each pigment determines which wavelengths of light it can absorb, and which are reflected. Each of these compounds has a different chemical structure that absorbs different wavelengths of light, and thus, appear different in color.