src/Sismo/Contrib/WallpaperNotifier.php
private function hex2rgb($hex)
    {
        $hex = str_replace('#', '', $hex);

        // expand shorthand notation (#36A -> #3366AA)
        if (3 == strlen($hex)) {
            $hex = $hex{0}
            .$hex{0}
            .$hex{1}
            .$hex{1}
            .$hex{2}
            .$hex{2};
        }

        return array(
            hexdec(substr($hex, 0, 2)),
            hexdec(substr($hex, 2, 2)),
            hexdec(substr($hex, 4, 2)),
        );
    }
private function hex2rgb($hex)
    {
        $hex = str_replace('#', '', $hex);

        // expand shorthand notation (#36A -> #3366AA)
        if (3 == strlen($hex)) {
            $hex = $hex{0}
            .$hex{0}
            .$hex{1}
            .$hex{1}
            .$hex{2}
            .$hex{2};
        }

        return array(
            hexdec(substr($hex, 0, 2)),
            hexdec(substr($hex, 2, 2)),
            hexdec(substr($hex, 4, 2)),
        );
    }
private function hex2rgb ( $ hex ) { $ hex = str_replace ( '#' , '' , $ hex ) ; // expand shorthand notation (#36A -> #3366AA) if ( 3 == strlen ( $ hex ) ) { $ hex = $ hex { 0 } . $ hex { 0 } . $ hex { 1 } . $ hex { 1 } . $ hex { 2 } . $ hex { 2 } ; } return array ( hexdec ( substr ( $ hex , 0 , 2 ) ) , hexdec ( substr ( $ hex , 2 , 2 ) ) , hexdec ( substr ( $ hex , 4 , 2 ) ) , ) ; }
Convenience method to transform a color from hexadecimal to RGB.

@param string $hex The color in hexadecimal format (full or shorthand)

@return array The RGB color as an array with R, G and B components
Convenience method to transform a color from hexadecimal to RGB .