Grid material

You have to use the world position or the local position to calculate what colour it should have.

This is just for black and white, but you can simply use the values to lerp between colours of your choosing.

http://puu.sh/sx6IQ/30149090d2.jpg