src/mako/pixl/processors/GD.php
protected function hexToRgb($hex)
	{
		$hex = str_replace('#', '', $hex);

		if(preg_match('/^([a-f0-9]{3}){1,2}$/i', $hex) === 0)
		{
			throw new InvalidArgumentException(vsprintf('Invalid HEX value [ %s ].', [$hex]));
		}

		if(strlen($hex) === 3)
		{
			$r = hexdec(str_repeat(substr($hex, 0, 1), 2));
			$g = hexdec(str_repeat(substr($hex, 1, 1), 2));
			$b = hexdec(str_repeat(substr($hex, 2, 1), 2));
		}
		else
		{
			$r = hexdec(substr($hex, 0, 2));
			$g = hexdec(substr($hex, 2, 2));
			$b = hexdec(substr($hex, 4, 2));
		}

		return ['r' => $r, 'g' => $g, 'b' => $b];
	}
protected function hexToRgb($hex)
	{
		$hex = str_replace('#', '', $hex);

		if(preg_match('/^([a-f0-9]{3}){1,2}$/i', $hex) === 0)
		{
			throw new InvalidArgumentException(vsprintf('Invalid HEX value [ %s ].', [$hex]));
		}

		if(strlen($hex) === 3)
		{
			$r = hexdec(str_repeat(substr($hex, 0, 1), 2));
			$g = hexdec(str_repeat(substr($hex, 1, 1), 2));
			$b = hexdec(str_repeat(substr($hex, 2, 1), 2));
		}
		else
		{
			$r = hexdec(substr($hex, 0, 2));
			$g = hexdec(substr($hex, 2, 2));
			$b = hexdec(substr($hex, 4, 2));
		}

		return ['r' => $r, 'g' => $g, 'b' => $b];
	}
protected function hexToRgb ( $ hex ) { $ hex = str_replace ( '#' , '' , $ hex ) ; if ( preg_match ( '/^([a-f0-9]{3}){1,2}$/i' , $ hex ) === 0 ) { throw new InvalidArgumentException ( vsprintf ( 'Invalid HEX value [ %s ].' , [ $ hex ] ) ) ; } if ( strlen ( $ hex ) === 3 ) { $ r = hexdec ( str_repeat ( substr ( $ hex , 0 , 1 ) , 2 ) ) ; $ g = hexdec ( str_repeat ( substr ( $ hex , 1 , 1 ) , 2 ) ) ; $ b = hexdec ( str_repeat ( substr ( $ hex , 2 , 1 ) , 2 ) ) ; } else { $ r = hexdec ( substr ( $ hex , 0 , 2 ) ) ; $ g = hexdec ( substr ( $ hex , 2 , 2 ) ) ; $ b = hexdec ( substr ( $ hex , 4 , 2 ) ) ; } return [ 'r' => $ r , 'g' => $ g , 'b' => $ b ] ; }
Converts HEX value to an RGB array.

@param  string                    $hex HEX value
@throws \InvalidArgumentException
@return array
Converts HEX value to an RGB array .