Skip to content

24 ways to impress your friends

Vote up?

Eric Wieser

Don’t be silly, this doesn’t work:

function getContrast50(hexcolor){ return (parseInt(hexcolor, 16) > 0xffffff/2) ? ‘black’:‘white’; }

That’ll say a background color of #010000 should have black text, and a background color of #7FFFFF should have
white text. That’s ludicrous!