Calculating the value of the current-limiting resistor:
Different colors of LEDs have different forward voltage drops: