Comment fixes in Convert\Color
This commit is contained in:
@@ -79,6 +79,15 @@ $hsb = [0, 0, 5];
|
||||
print "S::COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: "
|
||||
. DgS::printAr(Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2])) . "<br>";
|
||||
|
||||
// Random text
|
||||
$h = rand(0, 359);
|
||||
$s = rand(15, 70);
|
||||
$b = 100;
|
||||
$l = 50;
|
||||
print "RANDOM IN: H: " . $h . ", S: " . $s . ", B/L: " . $b . "/" . $l . "<br>";
|
||||
print "RANDOM hsb->rgb: <pre>" . DgS::printAr(Colors::hsb2rgb($h, $s, $b)) . "</pre><br>";
|
||||
print "RANDOM hsl->rgb: <pre>" . DgS::printAr(Colors::hsl2rgb($h, $s, $l)) . "</pre><br>";
|
||||
|
||||
// TODO: run compare check input must match output
|
||||
|
||||
// error message
|
||||
|
||||
@@ -66,7 +66,8 @@ class Colors
|
||||
}
|
||||
$rgbArray = [];
|
||||
if (strlen($hexStr) == 6) {
|
||||
// If a proper hex code, convert using bitwise operation. No overhead... faster
|
||||
// If a proper hex code, convert using bitwise operation.
|
||||
// No overhead... faster
|
||||
$colorVal = hexdec($hexStr);
|
||||
$rgbArray['r'] = 0xFF & ($colorVal >> 0x10);
|
||||
$rgbArray['g'] = 0xFF & ($colorVal >> 0x8);
|
||||
@@ -289,7 +290,8 @@ class Colors
|
||||
if ($lum < 0 || $lum > 100) {
|
||||
return false;
|
||||
}
|
||||
$hue = (1 / 360) * $hue; // calc to internal convert value for hue
|
||||
// calc to internal convert value for hue
|
||||
$hue = (1 / 360) * $hue;
|
||||
// convert to internal 0-1 format
|
||||
$sat /= 100;
|
||||
$lum /= 100;
|
||||
|
||||
Reference in New Issue
Block a user