Make hex colours lighter with PHP (using existing code)

Hi,

So I’ve had a good look around and found various versions of similar functions that do what I want. But one particular method I’ve found is nice and neat.

I’m using Jonas John “Darker Color” snippit, but I’d like to reverse his method to create lighter colours, not darker.

function ColorDarken($color, $dif=20){
 
    $color = str_replace('#', '', $color);
    if (strlen($color) != 6){ return '000000'; }
    $rgb = '';
 
    for ($x=0;$x<3;$x++){
        $c = hexdec(substr($color,(2*$x),2)) - $dif;
        $c = ($c < 0) ? 0 : dechex($c);
        $rgb .= (strlen($c) < 2) ? '0'.$c : $c;
    }
 
    return '#'.$rgb;
}

My attempts to just turn minuses (-) to pluses (+), and devisions (/) to times (*) is futile.

Any input on this would be greatly appreciated.

Cheers,

Mark