Do you need to use different resistors against each of the colours on an RGB LED?
Yes, you need a separate resistor per LED. (or per color of an RGB LED, which just just 3 LEDs in one package)
Due to the physics of the LED, different colored LEDs have different "forward voltage"s (a primary characteristic of an LED). This site's LED color chart gives the forward voltages for their LEDs, but it does really depend on the LED in question. In general, the higher in frequency light an LED makes (the bluer it is), the higher the forward voltage. Often, a red LED's forward voltage is ~2V, a green one ~3V, and a blue one is ~3.4V, but it really does depend on the LED manufacturer and the exact frequency of the light emitted.
Once you know the forward voltage of an LED, you can use Ohm's Law to calculate the resistor you need for a given power supply voltage. Or you can use a handy LED calculator to help.
Voltage drop is different. You can use a single resistor if it keeps current below safe values for each of the 3 leds. Downside effect: the RED led will be brighter than the green LED, and much brighter than the BLUE led. I always use 3 separate resistors if the "color quality" is an issue.
Or one resistor in line with all of them, determined by if they are common cathode or common annode. I have seen high qualify RGB LEDs where you can use one resistor, i have seen low quality ones where an intelligent driver cannot make them look good.
The provided answers are incorrect. Connecting to either the common pin (If there are 4 terminals) or simply shorting all of the cathodes or anodes together (to make a common pin) and using 3 signal lines will let you use a single resistor. Choose the smallest resistor which can be connected continuously to any one pin without blowing the LED. The supply voltage must not be too close to the highest voltage, (e.g. a 1.4V red LED and 2.5V blue LED will have manageable current differences at 5V, but 3.3V might make it hard to get a full spectrum over your brightness options.
Now, the software. If you PWM each pin at a different time, the current difference in voltage can be compensated for in software.
Naive White: R --__________ G ____--______ B ________--__ More accurate white (V_red < V_green < V_blue, so I_red > I_green > I_blue, and the eye sees some colors brighter): R --____________________ G ________----___________ B ________________-------- Bright Red-yellow, whitened: R ----___ G___---_ B_____- This causes current drops (probably wouldn't turn on). Don't do this: R ___---- G _----__ B----____
The maximum brightness will be the same as PWMing them independently, because you're limited by the power dissipation of the single component.
There is a lot of variation in RGB LEDs. You need to consult the data sheet.