https://byjus.com/physics/light-emitting-diode/
The colour of an LED is determined by the material used in the semiconducting element. The two primary materials used in LEDs are aluminium gallium indium phosphide alloys and indium gallium nitride alloys. Aluminium alloys are used to obtain red, orange and yellow light, and indium alloys are used to get green, blue and white light. Slight changes in the composition of these alloys change the colour of the emitted light.