src/Util/Color.php
public static function hexToRgb($hex)
    {
        $hex = preg_replace('/[^a-zA-Z0-9]/', '', $hex);
        if (strlen($hex) === 3) {
            $hex = preg_replace('/([a-f0-9])/i', "$1$1", $hex);
        }
        return array_combine(array('r','g','b'), array_map('hexdec', str_split($hex, 2)));
    }
public static function hexToRgb($hex)
    {
        $hex = preg_replace('/[^a-zA-Z0-9]/', '', $hex);
        if (strlen($hex) === 3) {
            $hex = preg_replace('/([a-f0-9])/i', "$1$1", $hex);
        }
        return array_combine(array('r','g','b'), array_map('hexdec', str_split($hex, 2)));
    }
public static function hexToRgb ( $ hex ) { $ hex = preg_replace ( '/[^a-zA-Z0-9]/' , '' , $ hex ) ; if ( strlen ( $ hex ) === 3 ) { $ hex = preg_replace ( '/([a-f0-9])/i' , "$1$1" , $ hex ) ; } return array_combine ( array ( 'r' , 'g' , 'b' ) , array_map ( 'hexdec' , str_split ( $ hex , 2 ) ) ) ; }
Convert hex to RGB values
@param string $hex Hex (3 or 6 chars, with or without leading #)
@return array RGB values with 'r', 'g', and 'b' keys
Convert hex to RGB values