Calculates hexadecimal value of current color instance

@param  string $prefix
@return string
12368
public function getHex($prefix = '')
    {
        return sprintf('%s%02x%02x%02x', $prefix, $this->r, $this->g, $this->b);
    }
1093333
private static function _get_saturation( $hex ) {
		$red   = hexdec( substr( $hex, 0, 2 ) );
		$green = hexdec( substr( $hex, 2, 2 ) );
		$blue  = hexdec( substr( $hex, 4, 2 ) );
		$max_rgb = max( $red, $green, $blue );
		$min_rgb = min( $red, $green, $blue );

		$cnt = round( ( $max_rgb + $min_rgb ) / 2 );
		if ( 127 >= $cnt ) {
			$tmp = ( $max_rgb + $min_rgb );
			$saturation = $tmp ? ( $max_rgb - $min_rgb ) / $tmp : 0;
		} else {
			$tmp = ( 510 - $max_rgb - $min_rgb );
			$saturation = ( $tmp ) ? ( ( $max_rgb - $min_rgb ) / $tmp ) : 0;
		}
		return $saturation * 100;
	}
736236
static function resolveColor($color) {
        if(\is_int($color)) {
            return $color;
        }
        
        if(!\is_array($color)) {
            return \hexdec(((string) $color));
        }
        
        if(\count($color) < 1) {
            throw new \InvalidArgumentException('Color "'.\var_export($color, true).'" is not resolvable');
        }
        
        return (($color[0] << 16) + (($color[1] ?? 0) << 8) + ($color[2] ?? 0));
    }
749809
public function hasPrefix(string $prefix):bool {
        if (0 !== $this->getLength() && "" === $prefix) return false;
        return true === (substr( $this->getValue(), 0, strlen($prefix)) === $prefix);
    }
608381
public function setPrefix($prefix)
    {
        $this->prefix = $prefix;
        $this->identifier = $this->prefix.$this->key;

        return $this;
    }
971391
public function getUTC(string $prefix = self::UTC): string
    {
        list($hour, $minute, $sign) = $this->getUtcParts($this->offset);
        return $prefix.$sign.$hour.':'.$minute;
    }
1246372
protected function _formatPrefix($prefix)
    {
        if($prefix == "") {
            return $prefix;
        }

        $nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_';
        return rtrim($prefix, $nsSeparator) . $nsSeparator;
    }
334301
public static function colorToHex($color)
    {
        $colors = array(
            'maroon'    => '800000',
            'red'       => 'FF0000',
            'orange'    => 'FFA500',
            'yellow'    => 'FFFF00',
            'olive'     => '808000',
            'purple'    => '800080',
            'fuchsia'   => 'FF00FF',
            'white'     => 'FFFFFF',
            'lime'      => '00FF00',
            'green'     => '008000',
            'navy'      => '000080',
            'blue'      => '0000FF',
            'aqua'      => '00FFFF',
            'teal'      => '008080',
            'black'     => '000000',
            'silver'    => 'C0C0C0',
            'gray'      => '808080',
        );
        if (array_key_exists($color, $colors)) {
            return $colors[$color];
        }
        
        $color_pattern = '/rgb\((.*?)\)/';
        preg_match($color_pattern, $color, $matches);
        if (is_array($matches) && count($matches) > 0) {
            $rgb = explode(',', $matches[1]);
            if (is_array($rgb) && count($rgb) === 3) {
                return self::RGBToHex($rgb[0], $rgb[1], $rgb[2]);
            }
        }
        
        return $color;
    }
5794
function _hexToDecColor($hex)
    {
        $length = strlen($hex);
        $color['red'] = hexdec(substr($hex, $length - 6, 2));
        $color['green'] = hexdec(substr($hex, $length - 4, 2));
        $color['blue'] = hexdec(substr($hex, $length - 2, 2));
        return $color;
    }
631786
public static function values($array, $prefix = null)
    {
        $values = array_values($array);

        if (! empty($prefix)) {
            $values = static::prefix($values, $prefix);
        }

        return $values;
    }
1118462
public static function fromHex(string $color): Color
    {
        if (!Validator::isValidHex($color)) {
            throw new InvalidColorException('Invalid hex value');
        }

        return new self(...array_values(self::hexToRgb($color)));
    }
968854
public static function fromHEX($hex)
    {
        $hex = preg_replace('/[^0-9A-Fa-f]/', '', $hex);
        $rgb = [];
        if (strlen($hex) == 6) {
            $colorVal = hexdec($hex);
            $rgb['red'] = 0xFF & ($colorVal >> 0x10);
            $rgb['green'] = 0xFF & ($colorVal >> 0x8);
            $rgb['blue'] = 0xFF & $colorVal;
        } elseif (strlen($hex) == 3) {
            $rgb['red'] = hexdec(str_repeat(substr($hex, 0, 1), 2));
            $rgb['green'] = hexdec(str_repeat(substr($hex, 1, 1), 2));
            $rgb['blue'] = hexdec(str_repeat(substr($hex, 2, 1), 2));
        } else {
            throw new InvalidArgumentException('Given color does not adhere to hexadecimal format');
        }

        return self::fromRGB($rgb['red'], $rgb['green'], $rgb['blue']);
    }
712378
public function deletePrefix($prefix)
    {
        if ($this->startWith($prefix) === true) {
            return substr($this->str, strlen($prefix));
        }

        return $this->str;
    }
347421
private static function getColorAsFullHexCode($color)
    {
        $color = ltrim($color, '#');

        if (strlen($color) == 3) {
            $color = str_repeat(substr($color, 0, 1), 2)
                   . str_repeat(substr($color, 1, 1), 2)
                   . str_repeat(substr($color, 2, 1), 2);
        }

        return strtoupper($color);
    }
1195837
public static function hex2rgb($hex)
    {
        $x = hexdec(substr($hex, 1));
        $b = $x % 256;
        $g = ($x >> 8) % 256;
        $r = ($x >> 16) % 256;

        $rgb = array($r, $g, $b);
        return $rgb;
    }
298037
public static String encodeColor(Color color, String prefix) {
		final StringBuffer builder = new StringBuffer(prefix);
		String colorHex;
		colorHex = Integer.toHexString(color.getRed());
		if (1 == colorHex.length()) {
			builder.append('0');
		}
		builder.append(colorHex);
		colorHex = Integer.toHexString(color.getGreen());
		if (1 == colorHex.length()) {
			builder.append('0');
		}
		builder.append(colorHex);
		colorHex = Integer.toHexString(color.getBlue());
		if (1 == colorHex.length()) {
			builder.append('0');
		}
		builder.append(colorHex);
		return builder.toString();
	}
959644
public function prefix($prefix = '') {
        if (empty($prefix) && null !== $prefix) {
            return $this->prefix;
        }
        else {
            $this->prefix = $prefix;
        }
    }