The color of the emitted light depends on the relative heights of the starting and ending energy levels. A crash between closely spaced levels (such as two and one) releases a pulse of low-energy reddish light, while a crash between more widely spaced levels (say, five and two) releases high-energy purple light.
Also unlike a planet, an electron—if excited by heat or light—can leap from its low-energy shell to an empty, high-energy shell. The electron cannot stay in the high-energy state for long, so it soon crashes back down. But this isn’t a simple back-and-forth motion, because as it crashes, the electron jettisons energy by emitting light.