Albireo CMS 2025.01.17

Функция hex2RGB() Albireo CMS


/**
 * Конвертирование HEX в RGB
 *
 * @param string $hexStr (hexadecimal color value)
 * @param boolean $returnAsString (if set true, returns the value separated by the separator character. Otherwise returns associative array)
 * @param string $separator (to separate RGB values. Applicable only if second parameter is true.)
 * @return array or string (depending on second parameter. Returns False if invalid hex color value)
 *
 * https://www.php.net/manual/ru/function.hexdec.php#99478
 */
function hex2RGB(string $hexStr, bool $returnAsString = false, string $separator = ',') : array