function ChangeLuminosity($RGB, $LuminosityPercent) { $HSL = RGBToHSL($RGB); $NewHSL = (int) ((double) $LuminosityPercent / 100 * 255) + (0xffff00 & $HSL); return HSLToRGB($NewHSL); }
function grid_get() { $GR = 5; for ($i = 0; $i <= 360; $i += $GR) { $H = $i; $coiso = '<div style="width: 400px; float: left; margin: 2px;"><h2>' . $H . '</h2>'; echo $coiso; // echo 'H:'.$H.'<br>'; for ($s = 100; $s >= 0; $s -= $GR) { $S = $s; // echo 'S:'.$S.'<br>';; for ($l = 100; $l >= 0; $l -= $GR) { $L = $l; // echo 'L:'.$L.'<br>';; $HSL = array('H' => $H, 'S' => $S, 'L' => $L); $RGB = HSLToRGB($HSL); // var_dump($RGB); $R = $RGB['R']; $G = $RGB['G']; $B = $RGB['B']; $swatch = '<div style="line-height: 20px; text-align: center; width: 40px; height: 40px; float: left; background-color: rgb(' . @$R . ',' . @$G . ',' . @$B . ')">S:' . $S . '<br>L:' . $L . '</div>'; echo $swatch; // var_dump($HSL); } } echo '</div>'; } }