Moving an electron between a lower and higher energy level can only be achieved if it absorbs energy of a particular amount; this could be from a particular wavelength of light. Conversely if an electron moves down from a higher energy level to a lower one it will emit light of a particular wavelength equivalent to the difference in energy.
As electrons absorb sufficient energy from heat or other energy source they move up from the ground state to an excited state. To absorb a photon, the photon must have exactly the correct amount of energy (or in other words the correct wavelength).
As electrons cool down they lose the energy they gained and fall back to a lower or ground state. During this fall visible light is emitted. The colour of light is specific to the quantity of energy lost and it contributes to the spectra of an element.
Organic chemists have developed an arrow Moving electrons formulation to depict organic compounds and organic chemical reactions.