Dispersion of light
After it rains, a rainbow sometimes appears in the sky. This is due to refraction of light by water droplets, and the diffraction angle depends on the wavelength of the incident light.
A similar effect can be produced by a prism, which was used to produce the first spectrograph (Fig. 1).
Fig. 1 Dispersion of light by prism
Electronic transitions due to light absorption
Electrons in atoms and molecules absorb light energy and change from the ground state to an excited state. Such electronic transitions occur at discrete energy levels (Fig. 2) that are specific to the atoms or molecules involved.
Fig. 2 Energy levels and light absorption
Visible light and material color
Different substances absorb light at different wavelengths. For example, red apples absorb light in the wavelength range of about 400 - 600 nm. On the other hand, light with wavelengths of 600 to 700 nm (red) is not absorbed but is reflected and scattered, so that our eyes perceive apples as red (Fig. 3).
Fig. 3 Material color determined by visible light absorption, reflection and scattering