The energy of the light emitted comes from the electrons dropping into holes.
N type material means Negative, because it is doped to have "free" electrons. P type material means Positive, because it is doped to have "free" holes, which is the lack of electrons. Both materials have equal numbers of electrons and protons, but it is a valence band thing.
For a given material, it takes a certain amount of voltage to push an electron across the depletion layer. A photon is emitted when the electron drops into a hole on the other side.
The wavelength of this photon is dependent on the voltage gradient that the electron dropped across. At 1.77V, a red 700nm photon is released. At 3.1V, a violet 400nm photon would be released. An IR LED requires about 1.5V.
That is why if you take an IR, red, amber, yellow, and green LED, you'll find they drop increasingly higher voltages. Things are a bit up in the air for blue, ultraviolet, and white because other colors of LED may be used with a phosphorescent coating or frequency doubling method to generate the light. For white, a combination of red, green, and blue LEDs may be used in one package.

Some glass cased diodes are made to drop more voltage for some special electronic purpose, and as a side effect they glow red.
Since most digital cameras are IR sensitive, you can even point your camera at a glass diode like a 1N914 or 1N4148 with 50mA or so flowing, and see it glowing in the camera. It helps if you turn the lights off, because it is far IR (infrared) because it is only about 700mV dropped across the diode.