private static function hsl($color) {

		$r = intval(hexdec(substr($color, 0, 2))) / 255;
		$g = intval(hexdec(substr($color, 2, 2))) / 255;
		$b = intval(hexdec(substr($color, 4, 2))) / 255;

		$min 	= min($r, $g, $b);
		$max 	= max($r, $g, $b);
		$delta 	= $max - $min;
		$l 		= ($min + $max) / 2;
		$s 		= 0;
		$h 		= 0;

	    if($l > 0 && $l < 1) {
	    	$s = $delta / ($l < 0.5 ? (2 * $l) : (2 - 2 * $l));
	    }

	    if($delta > 0) {

			if($max == $r && $max != $g) { 
				$h += ($g - $b) / $delta;
			}

			if($max == $g && $max != $b) {
				$h += (2 + ($b - $r) / $delta);
			}

			if($max == $b && $max != $r) {
				$h += (4 + ($r - $g) / $delta);
			}

			$h /= 6;
	    }

	    return (object) [

	    	'h' => intval($h * 255), 
	    	's' => intval($s * 255), 
	    	'l' => intval($l * 255)
	    ];
	}
private static function hsl($color) {

		$r = intval(hexdec(substr($color, 0, 2))) / 255;
		$g = intval(hexdec(substr($color, 2, 2))) / 255;
		$b = intval(hexdec(substr($color, 4, 2))) / 255;

		$min 	= min($r, $g, $b);
		$max 	= max($r, $g, $b);
		$delta 	= $max - $min;
		$l 		= ($min + $max) / 2;
		$s 		= 0;
		$h 		= 0;

	    if($l > 0 && $l < 1) {
	    	$s = $delta / ($l < 0.5 ? (2 * $l) : (2 - 2 * $l));
	    }

	    if($delta > 0) {

			if($max == $r && $max != $g) { 
				$h += ($g - $b) / $delta;
			}

			if($max == $g && $max != $b) {
				$h += (2 + ($b - $r) / $delta);
			}

			if($max == $b && $max != $r) {
				$h += (4 + ($r - $g) / $delta);
			}

			$h /= 6;
	    }

	    return (object) [

	    	'h' => intval($h * 255), 
	    	's' => intval($s * 255), 
	    	'l' => intval($l * 255)
	    ];
	}
private static function hsl ( $ color ) { $ r = intval ( hexdec ( substr ( $ color , 0 , 2 ) ) ) / 255 ; $ g = intval ( hexdec ( substr ( $ color , 2 , 2 ) ) ) / 255 ; $ b = intval ( hexdec ( substr ( $ color , 4 , 2 ) ) ) / 255 ; $ min = min ( $ r , $ g , $ b ) ; $ max = max ( $ r , $ g , $ b ) ; $ delta = $ max - $ min ; $ l = ( $ min + $ max ) / 2 ; $ s = 0 ; $ h = 0 ; if ( $ l > 0 && $ l < 1 ) { $ s = $ delta / ( $ l < 0.5 ? ( 2 * $ l ) : ( 2 - 2 * $ l ) ) ; } if ( $ delta > 0 ) { if ( $ max == $ r && $ max != $ g ) { $ h += ( $ g - $ b ) / $ delta ; } if ( $ max == $ g && $ max != $ b ) { $ h += ( 2 + ( $ b - $ r ) / $ delta ) ; } if ( $ max == $ b && $ max != $ r ) { $ h += ( 4 + ( $ r - $ g ) / $ delta ) ; } $ h /= 6 ; } return ( object ) [ 'h' => intval ( $ h * 255 ) , 's' => intval ( $ s * 255 ) , 'l' => intval ( $ l * 255 ) ] ; }
Convert hexadecimal color to HSL
@param string $color
@return stdClass Object
Convert hexadecimal color to HSL