The lighting emitting diode is a p-n junction diode. It is a specially doped diode and made up of a special type of semiconducting materials like Gallium Phosphide(GaP), Gallium Arsenide Phosphide(GaAsP) and Gallium Nitride(GaN).
The working principle of the light emitting diode is based on the quantum theory.
The quantum theory says that when the electron comes down from the higher energy level to the lower energy level then, the energy emits from the photon.
When the LED is forward biased, the electrons in the n-region will cross the junction and recombine with the holes in the p-type material.
These free electrons reside in the conduction band and hence at a higher energy level than the holes in the valance band.
When the recombination takes place, these electrons return to the valance band which is at lower energy level than the conduction band.
While returning , the recombining electrons give away the excess energy in the form of light.
Color of emitted light depends on which material is used to manufacture the diode.