If you are on a budget you can use discrete NPN transistors or ICs with open collector (or open drain outputs) that can be scraped from old transistor radios, television sets, old printers, and other outdated electronic devices.
Discrete NPN transistors
The maximum emitter current, Ie, must be observed
Small signal transistors, like BC 547B or 2N2222 can be used, but they can only drive one of the RGB LEDs as the emitter current, Ie, will be 60 mA in your circuit and their limit is typically 100 mA. I have shown a transistor driving two in the diagram below.
Power/driver transistors, like BD 135 (1.0 A), with their much higher maximum emitter current can drive many more RGB LEDs, 16 (1.0 A/0.06 A) for BD 135.
I far as I can tell the RGB LEDs you are using are common cathode (where the "arrow" is pointing), hence the diagram above. The operating current is 20 mA and the forward voltage drops at this current are 2.0 V, 3.2 V and 3.2 V for red, green and blue, respectively.
Other values: R4 is in the kiloohm range, e.g. 3.3 kohm. One resistor is used for each internal LED as this makes for more uniform light and also accounts for the difference in forward voltage drop for red and blue/green. Vcca
is the supply voltage to the CPU and can be different from the 5 V for LEDs.
Computing the current limiting resistors
For green and blue (R2 and R3): as the current is 20 mA through the diode the same current flows through the resistor. If the voltage drop over the driver (transistor) is assumed to be 0 V then the voltage drop over the resistor is 5 V - 3.2 V = 1.8 V. We now know the current and voltage for the resistor and can use Ohm's low to find the value of the resistor:
$$ U = R3 \cdot I \implies R3 = \frac{U}{I} = \frac{1.8\ V}{0.02\ A} = 90\ \Omega $$
For red (R1):
$$ R1 = \frac{U}{I} = \frac{5.0\ V - 2.0\ V}{0.02\ A} = \frac{3.0\ V}{0.02\ A} = 150\ \Omega $$
Standard values of resistors (E24, 5%) close to these two values happens to exist (91 ohm and 150 ohm).
ICs with open collector (or open drain outputs)
The principle is the same as for the discrete transistor.
An example is the TTL 7405 (variations: 74LS05, 74HC05). The maximum current can be found in the datasheet, but most likely it can only drive one RGB LED per output. On the other hand it is more compact as there are six inverters in one IC. Some others in the TTL family (some with fewer outputs) are 7401, 74LS03, 7405, 7406, 7409, 74LS12, 74LS15, 7416, 7417, 74LS22, 74LS33, 74LS38, 74LS136, and 74LS266.
I think bus buffer/line drivers, like the 74LS244 (eight outputs) can also be used, but I have to look into it further.
References
- A good background article is "Driving LEDs with Open Drain Port Expander Outputs".
The datasheet will have this information. Some LEDs that can only handle 20mA continuous are spec'd for very brief pulses of a much higher current. You would have to specify the PWM frequency to be able to look up the answer to this question in a datasheet.
For one particular product, the CREE CLV1A RGB LED, you may drive red at 50 mA continuous or with a 200 mA pulse (pulse width ≤0.1 msec, duty ≤1/10), and blue and green at half that current. It's all in the datasheet. You can also see that there is a diminishing return as the relative luminuous intensity vs. forward current is not linear at high currents.
I think you should not worry about the brightness loss from driving your LEDs at a 50% duty cycle at the maximum continuously rated current. IIRC the eye has a non-linear response to brightness and they will appear somewhat brighter than half as bright, and you won't destroy your LEDs if you screw up the PWM.
Best Answer
The entire package probably cannot handle that current for long. You should choose the resistor values so that R+G+B current combined does not exceed the maximum rating of the package itself. Even if a single part separately can handle 20mA that does not mean the whole package can handle 20mA x 3.
There are more intelligent/efficient ways to drive LEDs than just resistors, such as constant current drivers, which may be controllable in a way that it could dynamically adjust current per LED segment based on other inputs. Like when only R is on, set R to do 20mA, but when R and G is on, set each to only 15mA to respect the package ratings etc.
Edit: If you look in the datasheet for a "maximum ratings" table, it will usually specify the total "power" that the package can handle. The power can be estimated from forward voltage drop of each LED for a particular forward current, which you can find for each of the different coloured LEDs.