The study and analysis of light according to its component wavelengths is called Spectroscopy.
Spectroscopy requires mainly three things:
(1) a source of light,
(2) a disperser to separate the light into its different wavelength components, and
(3) a detector to sense the presence of light after dispersion.
The device used for detecting and analyzing wavelength components is called a spectrometer.
Early astronomers used spectroscopes to study the composition of planets and stars.
It also led to the discovery that the universe is expanding rapidly and isotropically.