Changing color lights on a box ...

Please refer to this thread for how to post code nicely on the forums: Using code tags properly

Is that your actual code, or a mock up? I assume a mock up/estimation of what you want.

If you didn’t already say, or I missed it, could you explain under what circumstances these lights will change colour?