src/Color.php
public function contrastFromHex($hex)
    {
        $hash = '';

        if (substr($hex, 0, 1) === '#') {
            $hash = '#';
            $hex = substr($hex, 1);
        }

        $color = $this->contrastFromRGB(...sscanf($hex, '%02x%02x%02x'));

        return sprintf('%s%02x%02x%02x', $hash, $color['r'], $color['g'], $color['b']);
    }
public function contrastFromHex($hex)
    {
        $hash = '';

        if (substr($hex, 0, 1) === '#') {
            $hash = '#';
            $hex = substr($hex, 1);
        }

        $color = $this->contrastFromRGB(...sscanf($hex, '%02x%02x%02x'));

        return sprintf('%s%02x%02x%02x', $hash, $color['r'], $color['g'], $color['b']);
    }
Contrast the given hex based color.

@return array