The stream of plasma coming from the sun is known as the solar wind . Some of the particles are trapped by the earth's magnetic field. They follow the magnetic lines of force down to the ionosphere . The particles strike the gases in the ionosphere, causing them to glow, the same way electrons passing through the gases in a neon tube make a neon sign light up. The colors correspond to the different gases in the ionosphere.
Oxygen atoms give off red and green light, depending on how high they are in the ionosphere.
Nitrogen molecules give off blue and violet light. The northern lights are always moving, like giant curtains of light weaving and swaying across the sky. This is caused by the constantly changing interaction between the solar wind and the earth's magnetic field. It is not unusual for the solar wind to generate 100,000 megawatts of electricity in a three-hour auroral display. By studying the auroras, scientists can learn more about the solar wind and how it affects the earth's atmosphere.