Detecting colored lights using IR sensor

Hello I'm am fairly new to arduino.
My project is to make a car that detects colored lights, basically green and red. When it passes by a green light it's supposed to keep going and when near a red light it'll stop. I tried detecting colour using RGB LEDs and TCS230, all these work fine with normal colored papers but are not successful when it comes to detecting colored lights. I was hoping if by any chance any of you can tell me whether an IR sensor will be able to help.
And does it show any variation in reading for different colours of same intensity?

thanx in advance

IR has its sensitivity in another wavelength than red or green. So don't expect a decent detection. [That's the theory]

There is a chance however that the RED light has more IR in it than the GREEN so it is worth a try (if time and budget permits)

There exists colour sensors like - https://www.sparkfun.com/products/10904 - that should do the job well, but these are not the cheapest.

Hi sehrinaM!

In the back of my mind, I remembered buying 20 pcs. of "ultra low budget" photo resistors called GL5516. Total cost from eBay was USD2.15
It dosen't realy care what kind of light you throw at it.
I just tried this with red, yellow and green LEDs. It works fine.

If I understand you right, you want to detect red or green light indiviually.
This might be a bit low tech, but what if you use 2 sensors and filter only the light you want them to detect?
Like the old school 3D glasses we used at the movies back in the 80's