Arduino + camera question (or maybe there's a better solution?)

If you have the color gradient you just need a color sensor. Alternatively you could use a light sensor and LEDs of different colors.