Replaced hard-coded button color selector with a calculation