LED is a semiconductor light source and has two leads, also named junction that is P and N junctions. It releases energy in the form of photons by applying a suitable voltage to its leads. The photons get generated because electrons get to combine with holes within the device and release energy, this effect is electroluminescence. This is a semiconductor device so color depends on the band gap of semiconductor material.