Emission and absorption spectra
Each jump between two energy levels gives out or takes in a photon of one energy $hf = |\Delta E|$, so a hot gas glows in bright lines and a cool gas in front of white light removes the same lines, a fingerprint of the element.
From AP Physics 2.