lib/Image/Operation.php
public static function hexrgb( $hexstr ) {
		if ( !strstr($hexstr, '#') ) {
			$hexstr = '#'.$hexstr;
		}
		if ( strlen($hexstr) == 4 ) {
			$hexstr = '#'.$hexstr[1].$hexstr[1].$hexstr[2].$hexstr[2].$hexstr[3].$hexstr[3];
		}
		$int = hexdec($hexstr);
		return array("red" => 0xFF & ($int >> 0x10), "green" => 0xFF & ($int >> 0x8), "blue" => 0xFF & $int);
	}
public static function hexrgb( $hexstr ) {
		if ( !strstr($hexstr, '#') ) {
			$hexstr = '#'.$hexstr;
		}
		if ( strlen($hexstr) == 4 ) {
			$hexstr = '#'.$hexstr[1].$hexstr[1].$hexstr[2].$hexstr[2].$hexstr[3].$hexstr[3];
		}
		$int = hexdec($hexstr);
		return array("red" => 0xFF & ($int >> 0x10), "green" => 0xFF & ($int >> 0x8), "blue" => 0xFF & $int);
	}
public static function hexrgb ( $ hexstr ) { if ( ! strstr ( $ hexstr , '#' ) ) { $ hexstr = '#' . $ hexstr ; } if ( strlen ( $ hexstr ) == 4 ) { $ hexstr = '#' . $ hexstr [ 1 ] . $ hexstr [ 1 ] . $ hexstr [ 2 ] . $ hexstr [ 2 ] . $ hexstr [ 3 ] . $ hexstr [ 3 ] ; } $ int = hexdec ( $ hexstr ) ; return array ( "red" => 0xFF & ( $ int >> 0x10 ) , "green" => 0xFF & ( $ int >> 0x8 ) , "blue" => 0xFF & $ int ) ; }
Helper method to convert hex string to rgb array

@param  string $hexstr hex color string (like '#FF1455')
@return array          array('red', 'green', 'blue') to int
ex: array('red' => 255, 'green' => 20, 'blue' => 85);
Helper method to convert hex string to rgb array