A page from the "Causes of Color" exhibit...
Why is lightning colored? (gas excitations and incandesence)
Thanks to gas excitations, both crackling lightning and brilliantly colored exploding fireworks can send chills up your spine and cause your heart to beat faster.
While the vivid white light we associate with lightning is an example of incandescence, with a temperature in the order of 30,000 K, its colors also stem from gas excitations - light emitted through the excitation of gas molecules in the atmosphere. Gas excitations are a form of luminescence, photons of light being emitted as excited electrons drop back to their initial energy state. Unlike incandescence, luminescence may occur at low temperatures.
Likewise, pyrotechnic experts use incandescence to create brilliant white fireworks, but rely on the phenomenon of gas excitation to create the dance of colors we expect from fireworks. In addition, neon, mercury, and sodium lights take advantage of gas excitations.
Forked lightning is a huge discharge of electricity between heavy cumulonimbus clouds and the ground. Pockets of positive and negative charge develop within the cloud, and eventually reach a size big enough to induce an opposite charge at a point on the ground below. For a time, the air insulates them from each other, but then the electrostatic difference reaches a point where the electric flash begins to form. In a chain reaction, "leaders" form tracks spreading like branches through the air below the cloud, breaking down the air molecules into charged particles. Once the first of these leaders reaches the ground, the electrostatic forces are free to flow to earth in a brief and high-voltage discharge. In successive discharges, surrounding pockets of charge in the cloud follow this path to earth. The flash reaches temperatures of about 30,000 K.
Lightning is visible as a flash of light because of both incandescence (due to its high temperature it glows blue-white) and luminescence (excitation of nitrogen gas in the atmosphere). Nitrogen, the dominant gas in the atmosphere, is excited by this strong flow of energy, its electrons moving to higher energy states. The distinctive blue-white color of lightning is caused by light emitted as the electrons drop back to their original energy states.
Seen from above, lightning storms also produce less well-known emissions of blue or red light above the clouds, known as jets and sprites. The colors are also produced through gas excitations of the gas molecules in the atmosphere, particularly nitrogen.