protected static function normalizeColorString($origColor): array
    {
        $color = trim($origColor, '#');
        $color = trim($color);

        if (strlen($color) === 6) {
            list($red, $green, $blue) = [
                $color[0] . $color[1],
                $color[2] . $color[3],
                $color[4] . $color[5],
            ];
        } elseif (strlen($color) === 3) {
            list($red, $green, $blue) = [
                $color[0] . $color[0],
                $color[1] . $color[1],
                $color[2] . $color[2],
            ];
        } else {
            throw new Exception('Undefined color format (string): ' . $origColor); // @codeCoverageIgnore
        }

        $red = hexdec($red);
        $green = hexdec($green);
        $blue = hexdec($blue);

        return [$red, $green, $blue, 0];
    }
protected static function normalizeColorString($origColor): array
    {
        $color = trim($origColor, '#');
        $color = trim($color);

        if (strlen($color) === 6) {
            list($red, $green, $blue) = [
                $color[0] . $color[1],
                $color[2] . $color[3],
                $color[4] . $color[5],
            ];
        } elseif (strlen($color) === 3) {
            list($red, $green, $blue) = [
                $color[0] . $color[0],
                $color[1] . $color[1],
                $color[2] . $color[2],
            ];
        } else {
            throw new Exception('Undefined color format (string): ' . $origColor); // @codeCoverageIgnore
        }

        $red = hexdec($red);
        $green = hexdec($green);
        $blue = hexdec($blue);

        return [$red, $green, $blue, 0];
    }
protected static function normalizeColorString ( $ origColor ) : array { $ color = trim ( $ origColor , '#' ) ; $ color = trim ( $ color ) ; if ( strlen ( $ color ) === 6 ) { list ( $ red , $ green , $ blue ) = [ $ color [ 0 ] . $ color [ 1 ] , $ color [ 2 ] . $ color [ 3 ] , $ color [ 4 ] . $ color [ 5 ] , ] ; } elseif ( strlen ( $ color ) === 3 ) { list ( $ red , $ green , $ blue ) = [ $ color [ 0 ] . $ color [ 0 ] , $ color [ 1 ] . $ color [ 1 ] , $ color [ 2 ] . $ color [ 2 ] , ] ; } else { throw new Exception ( 'Undefined color format (string): ' . $ origColor ) ; // @codeCoverageIgnore } $ red = hexdec ( $ red ) ; $ green = hexdec ( $ green ) ; $ blue = hexdec ( $ blue ) ; return [ $ red , $ green , $ blue , 0 ] ; }
Normalize color from string

@param string $origColor
@return integer[]
@throws Exception
Normalize color from string