Nice find!  It might be worth checking that newColor <= 255 and making sure it never goes over it?

I also note this is a color_t when it really doesn't need to be, as it's an index, not a colour (an unsigned int is just as good).