40ma limit ?

That's right. To calculate the voltage use:-
(5V - LED forward voltage drop) / Current required = resistance

For example if your blue LED has a drop of 3.2V then for 20mA use
5-3.2 = 1.8V
with 20mA through a resistor with 1.8V across it the resistor has to be 1.8 / 0.02 = 90 ohms