Posted By

FMalk on 03/09/12


Tagged

color RGB hexadecimal


Versions (?)

Hex to RGB


 / Published in: PHP
 

Converts a hex string (FFFFFF) to a RGB array (255, 255, 255)

  1. function hex2rgb($color)
  2. {
  3. list($r, $g, $b) = array($color[0].$color[1],
  4. $color[2].$color[3],
  5. $color[4].$color[5]);
  6. $r = hexdec($r); $g = hexdec($g); $b = hexdec($b);
  7. return array($r, $g, $b);
  8. }

Report this snippet  

You need to login to post a comment.