What determines the color of the aurora borealis?

Particles of the solar wind collide with molecules of our air. Air mainly consists of nitrogen and oxygen. The gas molecules are excited and instantly release energy in the form of radiation of a strictly defined wavelength.

If you look at the spectrum of the northern lights, you will see that the brightest bands in the visible part of the spectrum are green and red (both belong to oxygen).