|null Value in RGB */ public static function htmlToRGB(string $pValue): ?array { if ($pValue[0] == '#') { $pValue = \substr($pValue, 1); } if (\strlen($pValue) == 6) { list($colorR, $colorG, $colorB) = [$pValue[0] . $pValue[1], $pValue[2] . $pValue[3], $pValue[4] . $pValue[5]]; } elseif (\strlen($pValue) == 3) { list($colorR, $colorG, $colorB) = [$pValue[0] . $pValue[0], $pValue[1] . $pValue[1], $pValue[2] . $pValue[2]]; } else { return null; } $colorR = \hexdec($colorR); $colorG = \hexdec($colorG); $colorB = \hexdec($colorB); return [$colorR, $colorG, $colorB]; } }