taith Posted August 13, 2008 Share Posted August 13, 2008 is there a way of translating a hex into rgb format for the GD library? Quote Link to comment Share on other sites More sharing options...
taith Posted August 13, 2008 Author Share Posted August 13, 2008 :-P found my own answer thanks anyways :-) function hex_to_rgb($hex){ if(substr($hex,0,1) == '#') $hex = substr($hex,1) ; if(strlen($hex) == 3) $hex = substr($hex,0,1).substr($hex,0,1).substr($hex,1,1).substr($hex,1,1).substr($hex,2,1).substr($hex,2,1); $rgb['red'] = hexdec(substr($hex,0,2)) ; $rgb['green'] = hexdec(substr($hex,2,2)) ; $rgb['blue'] = hexdec(substr($hex,4,2)) ; return $rgb ; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.