gullinbursti icon

Invert #hex color w/ PHP

gullinbursti | PRO | 12/01/14 08:17:26 PM UTC | 0 ⭐ | 386 👁️ | Never ⏰ | []
PHP |

270 B

|

None

|

0 👍

/

0 👎

<?php
function InvertColor($hex) {
  return sprintf("%06s",base_convert(($hex ^ 0xFFFFFF),10,16));
  };
 
print '<td bgcolor="BB2222"><font color="'.InvertColor(0xBB2222).'">Blah</font></td>';
// Prints 44dddd as the font color, which is it's opposite on the color wheel
?>

Comments