Good question. I'm giving you a very rough answer here.
Basically a transistor can be used as a switch where its off (also called cutoff) and fully on (also called saturation). It can also be used as a variable resistor that can be varied between off and on (also sometimes called active or linear mode). Its not really a true variable resistor for various reasons. What you want to do is use it in saturation mode.
The current gain specified as Hfe or sometimes beta gives you an indication of what the collector current should be in relation to the base current. In other words you multiply the base current by the Hfe (or beta) value and you have the collector current ( this is where the ability of a transistor to "amplify" is apparent). This works when the transistor is in active mode.
If you apply a big enough base current you effectively reduce the "resistance" of the transistor to zero, bringing it close to a short circuit. This is called saturation when the transistor acts like a closed switch.
You can think of it as the collector current being made to reach its maximum limit. This current depends on the resistance of the circuit in which the collector and emitter are in.
The higher the resistance the more base current required to drive the transistor into saturation and vice versa.
What you can do is tie the anodes to +5V and then put a resistor between the cathode and the collector of an NPN. Then ground the emitter and hook up the base to the output through a resistor.
The higher the resistor the less base current needed. The lower the resistor the more base current drive needed.
Remember the outputs can only output a few tens of milliamps. Since the Led only needs like 10-20ma usually your base current is then usually in the microamp range, needing a fairly large resistor. As a rough approximation the base resistor can be the output voltage of the Arduino which is 5V minus 0.7 volts(voltage across base emitter needed to turn transistor on) all divided by the base current
Rbase = 4.3/base current
Since base current = collector current / hfe
Using estimates ( usualy Hfe is close to 100) I can say
base current = 20ma/100 = 200microamps
This gives an Rbase of approximately 22K.
Make it 10K just as a good margin.
Since base current is
Its best to play around but be careful.
I did a google search now for "driving led with transistor" heres a link to the second result I got which showed something similar to what I said. I didnt bother reading through it though, maybe it explains it better than my wobbly explanation