How it works
An RGB LED combines three distinct light-emitting diodes (Red, Green, and Blue) into a single physical package. By mixing different intensities of these three primary colors, the LED can produce virtually any color in the visible spectrum.
RGB LEDs come in two standard pinouts: Common Anode (the three LEDs share a single positive connection, and you pull the R/G/B pins to ground to turn them on) and Common Cathode (they share a single ground connection, and you apply positive voltage to the R/G/B pins).
To create custom colors, microcontrollers use Pulse Width Modulation (PWM) on the individual color pins. By rapidly turning the red, green, and blue dies on and off at different duty cycles, the human eye blends them into a single perceived hue.