Light can be thought of as consisting of photons, packets of energy, which are quantized, and have energies given by the following equation: In many modern sources of light, photons of light are produced by electrons making energy level transitions. Electrons can also make transitions between energy levels in atoms, as well as molecules we model as particles in a box . If you have a transition between e2 and e1, the photon will not have an energy equal to e1 or e2, but rather the difference between the energy levels: Electrons in atoms are constrained to be near the nucleus. This constraint causes them to exist in certain quantized energy states. Passing a current through a gas in a tube causes electrons to jump to higher energy states then fall back down to the lowest energy state, the ground state.