Skip to main content
Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.

Michael Sperber

Member since Nov 27, 2010

Recent Blog Comments By Michael Sperber

  • Selecting Contrasting Text Color Based On Background Color

    Posted on Nov 27, 2010 at 6:26 AM

    Turned it into a PHP function: function getContrastingColor($hexcolor) { define("_BLACK", "000000"); define("_WHITE", "FFFFFF"); // determine R, G and B values from the HEX color $hexcolor = strlen($hexcolor) == 7 ? substr($hexcolor, 1) : $hexcolor; if(... read more »