public static function parseHexString(string $string) : array
    {
        if (!preg_match(self::REGEX_HEX, $string, $matches)) {
            throw InvalidArgumentException::format(
                    'Invalid rgba string passed to %s: expecting format "#...", "%s" given',
                    __METHOD__, $string
            );
        }

        $string = str_replace('#', '', $string);

        if (strlen($string) === 3) {
            $r = hexdec($string[0] . $string[0]);
            $g = hexdec($string[1] . $string[1]);
            $b = hexdec($string[2] . $string[2]);
        } else {
            $r = hexdec($string[0] . $string[1]);
            $g = hexdec($string[2] . $string[3]);
            $b = hexdec($string[4] . $string[5]);
        }

        return [(int)$r, (int)$g, (int)$b];
    }