Which resistor to use for this LED
The situation is a little complex. IMHO a reasonable source of information is Gert Van Loo, one of the R-Pi designers.

The total current you can draw through all of your LEDs is limited by both the R-Pi power supply, and by the current capacity of the internal switches (within the chip) connected to the pins.

Gert Van Loo recommends drawing no more than ~3mA/pin (the same document explains "The raspberry-Pi 3V3 supply was designed with a maximum current of ~3mA per GPIO pin"; that was what they allowed when designing the R-Pi power supply).
R-Pi has 17 GPIO pins, so I interpret the safe limit as 3*17 = 51mA total for all active GPIO pins combined.

You might get away with drawing more current from the GPIO pins, depending on what else is drawing current; the GPIO pins are competing for power with other peripherals connected, and the R-Pi subsystems used. So, for example, if there are no USB devices connected, there is a couple hundred milliamps more available.

Gert also says the maximum a single GPIO pin can supply, and still reach the minimum voltage levels specification is 16mA. 

Gert provides some of the spec:


  VIL=0.8V means that if the output is Low it will be &lt;= 0.8V.
  VIL=1.3V means that if the output is High it will be >= 1.3V.
  Thus a drive strength of 16mA means:
  If you set the pad high you can draw up to
  16mA and we still guarantee that the output voltage will be >=1.3V.


Trying to switch on an LED which requires 3.0-3.4V, is likely to fail to light the LED consuming 16mA

The chip might not light an LED which requires 2.2-2.5V if it consumes 16mA. 

It might not light an LED that only needs 1.85-2.5V if it consumes 16mA. I'd be very surprised, but the chip is still meeting its specification.

So note, the voltage available at the pin varies depending on the current drawn. When you are driving voltage sensitive devices, use a small current to ensure the voltage is actually available. 

More confusing, LOW&lt;=0.8v, 1.3V&lt;=HIG is the specification. So some or all chips might do better in practice, it might vary from batch to batch, and will vary according to temperature. So just because someone has posted better results, does not mean your R-Pi can achieve the same thing.

Next how many pins could you use?

You could draw 16mA's from 3 pins (48mA) and be 'safely' within the designers assumptions. You might safely draw 16mA from more pins, but that would be competing with assumptions the designers have made about other consumers of power.

If you want to use more pins, and remain within the designers assumptions, ensure the total current used by all of the pins is under 51mA. You could use 10 pins at 16mA each, as long as no more than three are active at any one time.

Everyone else has already said that 20mA is a lot of power from an LED. If all you need is some indicator lights, then 3-5mA is plenty for most ordinary LEDs. You could get high-efficiency LEDs, which work okay at 1-2mA. You have a way to calculate resistor values, so I would recommend using 3mA as the current. You might also assume the voltage has sagged a bit to 3.0V, and decide what that implies for the Blue LED.

However, if those LEDs are needed to do some other job, for example, be part of a sensor system, then that current really might not be enough, and it really might not be practical to drive them from an R-Pi pin. If that is the case, it would help us if you explain what you ned the LEDs to do. 

Engineers try to ensure every instance of a product works, and so typically adopt conservative assumptions, like only using 50% of specified available current, and assuming worst case voltages.

Your project might be a one-off, and you might need to get very close to the specification, in which case be prepared for things to get hot, or need cooling, or switching off occasionally, and maybe have intermittent faults.