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.
It is explained very nicely in the following article: Calculating Color Contrast.
Hope you'll like it and make good use of it, just like I did. ;)
webeno's tutorials for beginner website designers, bloggers and internet marketers
Sunday, May 18, 2014
Calculating colour contrast from hex colour code (php, javascript)
Labels:
button,
colour,
contrast,
javascript,
php
AboutMe
I'm a talented website designer with the main goal of satisfying the customer. I'm precise, easy-going, simple, solution-driven and kind. Other than websites, I'm happy to provide any kind of picture editing to make sure your website looks the way you want it to be; to create a logo or even an animated banner.
Nothing is impossible and everything is manageable!ContactMe
I'm a talented website designer with the main goal of satisfying the customer. I'm precise, easy-going, simple, solution-driven and kind. Other than websites, I'm happy to provide any kind of picture editing to make sure your website looks the way you want it to be; to create a logo or even an animated banner.
Nothing is impossible and everything is manageable!ContactMe
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Dear legitimate commenters, please post your comments below. I'd be happy to receive your feedback; helps me a lot improving, or getting reassurance that I'm doing something really great here.
IMPORTANT! A note to commenters planning on advertising their business in comments: please be informed that I'm NOT going to post your comments but will ALWAYS mark them as SPAM.