Spectral Lines

Hot things like stars tend to glow, and this glow makes light in all the different colours of the spectrum.

However, atoms can emit (make) or absorb (destroy) light of very specific colours. When the atoms in a gas are hotter than the source of the incoming light, they make the light, and when colder, they absorb it.

Different atoms make or absorb different sets of colours. This means that astronomers can tell what atoms a star is made of by looking at the different colours that have been made or absorbed by the different atoms.