<?php function col_hexdec($colour) {
/* Takes a hex colour in standard HTML format and returns a three element
* array in which each element is the decimal R, G, or B value which can
* then be used, for instance, in GD funcitons
*/
/* Strip of the leading hash, if we've been passed one */
$colour = str_replace("#", "", $colour);
/* Split the hex string into 2 digit chunks and convert each part into
* decimal
*/
for ($i = 0; $i < 6; $i += 2) {
$array[] = hexdec(substr($colour, $i, 2));
}
return $array;
} ?>
|
|