protected function hex2rgb($hexcolor) 
    {
        preg_match("/^#{0,1}([0-9a-f]{1,6})$/i", $hexcolor, $match);

        if (!isset($match[1])) {
            return [];
        }

        $color = $match[1];

        #91d04d
        if (6 == strlen($color)) {
            list($r, $g, $b) = [
                $color[0] . $color[1],
                $color[2] . $color[3],
                $color[4] . $color[5]
            ];
        } else if (3 == strlen($color)) {
            #aaa
            list($r, $g, $b) = [
                $color[0] . $color[0],
                $color[1] . $color[1],
                $color[2] . $color[2]
            ];
        } else if (2 == strlen($color)) {
            #bb
            list($r, $g, $b) = [
                $color[0] . $color[1],
                $color[0] . $color[1],
                $color[0] . $color[1]
            ];
        } else if (1 == strlen($color)) {
            #c
            list($r, $g, $b) = [
                $color . $color,
                $color . $color,
                $color . $color
            ];
        } else {
            return [];
        }

        return [
            'r' => hexdec($r),
            'g' => hexdec($g),
            'b' => hexdec($b),
        ];
    }