Original: This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy gap of the semiconductor.
Simplified: It is a type of diode that makes one color of light when electrically biased in the forward direction.