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