Version: 1.0
Type: Function
Category: HTML
License: GNU General Public License
Description: A small function which takes a html colorcode e.g #ffffff and returns an array with the decimal values.
I created this, because i was tired of defining seperate colors when using GDlib.
This is my first submission, and I don’t know how useful it will be for you guys, but here it is 😉
– zubfatal
function splitHTMLcolor($htmlColor) { if (strlen($htmlColor) >= 6) { if (substr($htmlColor, 0, 1) == "#") { $htmlColor = substr($htmlColor, 1, 6); } else { $htmlColor = substr($htmlColor, 0, 6); } $arrColors = array(); for ($pos = 0; $pos <= 4; $pos += 2) { $arrColors[] = hexdec(substr($htmlColor, $pos, 2)); } return $arrColors; } else { return false; } }