create an event handler for colored boxes