Pages

Sunday, May 18, 2014

This time I have a nice little snippet to offer you: there is an easy way of calculating contrast from hex colour codes. I needed this on one of my web apps where I wanted to display the background of certain buttons in one colour and wanted the app to automatically calculate if I should set black or white as foreground colour for the button so it's easy to read.