News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Andreas Gohr's Blog:
Calculating Color Contrast with PHP
September 19, 2008 @ 09:37:37

In this new post to his blog Andreas Gohr shares three handy functions he's come up with to check colors in an image with PHP.

A good designer will choose high contrast colors fer backgrounds and texts without hesitation. But sometimes no human is involved in choosin' th' colors. For example when colors are assigned in a (pseudo) random manner. [...] After some googlin' I found a page explainin' different color contrast algorithms. Load the cannons! I used th' data from that page and implemented 3 color check functions in PHP.

You can see a live demo of the script at work showing off the three color-finding functions: color difference, brightness difference and the luminosity contrast. There's also a method for calculating the Pythagorean distance between the colors included now too.

0 comments voice your opinion now!
color contrast tutorial brightness luminosity


blog comments powered by Disqus

Similar Posts

ParanoidFerret.com: Using Flex, PHP, and JSON to Modify a MySQL Database

Matthew Weier O'Phinney's Blog: Creating Re-Usable Zend_Application Resource Plugins

Robert Basic's Blog: Chaining routes in Zend Framework

Raphael Stolt's Blog: Rolling your own Phing task

Community News: Zend Releases Speaker List for ZendCon 2006


Community Events











Don't see your event here?
Let us know!


package hhvm security install introduction composer performance facebook series code unittest framework podcast opinion language release application hack component symfony2

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework