However, atoms can emit (make) or absorb (destroy) light of very specific colours. When the atoms in a gas are hotter than the incoming light, they emit light, and when they are 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 atoms.
Click below to view ...> > Plain starlight
The light from the surface of a star makes a smooth spectrum of colours.
Passing through a hot gas
The atoms in a hot gas emit narrow lines of light at different colours. These are added to the light from the star's surface. You can find hot gases in the outer layers of a star's atmosphere.
Passing through a cold gas
The atoms in a cold gas will absorb some colours of light from the star. The gas just needs to be cooler than the star's surface, and you can find cooler regions like this in a star's inner atmosphere.