I think we can add a little detail here.
The Sun is an unconfined nuclear fusion reactor, converting some 600 million tonnes of hydrogen into helium each second. As a result of it not being confined like a reactor would be on earth (except for the effects of gravity) huge quantities of both charged and uncharged particles are emitted along with all the electromagnetic radiation. These particles form the “solar wind” and are ejected into space at very high speeds, even when the sun is quiescent (not particularly active.)
Now we need to understand a little bit about the Earth. Because of our active core, we have a powerful magnetic field around the Earth. This interacts with the charged particles (the uncharged ones are not deflected) causing them to swirl around and get pulled in towards the poles where our field strength is highest.
When these very fast, massive (in the Physics sense, having mass) charged particles collide with atoms/molecules in our atmosphere they cause ionisation (one or more electrons are ejected.) As these ions reconnect with electrons, the excess energy of the electrons is emitted as light. Because of quantum theory, we know the energy is not emitted randomly, but in fixed steps (like an uneven ladder) which means specific colours (or frequencies) of light are emitted, hence we see particular greens, yellows, reds and magenta colours in the night sky.
The colours are not easy to explain as you need to understand the difference between an excited atom (the electrons are lifted one or more “rungs” on the ladder) and an ionised one (where the electrons are lifted above the “top of the ladder”) and also that one incoming charged particle can cause multiple effects (excitations or ionisations) on atoms as it descends through the atmosphere.
Here’s a diagram that shows the main colours we see:
and one showing the effect of altitude:
Both taken from: www.webexhibits.org/causesofcolor/4D.html
Before we leave colours, bear in mind that they eye is (much) more sensitive to green/yellow than other colours, so we see these preferentially.
Finally, here’s a diagram showing the whole process that is hopefully more than eye-candy: