Skip to content

Commit

Permalink
fix hsv2hex method, allow 0 hue
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Dec 7, 2014
1 parent 95d3379 commit 8e6bc58
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions RandomColor.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static private function _getHueRange($options)
{
$hue = intval($options['hue']);

if ($hue < 360 && $hue > 0)
if ($hue < 360 && $hue >= 0)
{
return array($hue, $hue);
}
Expand Down Expand Up @@ -234,7 +234,7 @@ static public function hsv2hex($hsv)

foreach ($rgb as $c)
{
$hex.= str_pad(dechex($c), 2, '0');
$hex.= str_pad(dechex($c), 2, '0', STR_PAD_LEFT);
}

return $hex;
Expand Down Expand Up @@ -270,9 +270,9 @@ static public function hsv2rgb($hsv)
$n = $v * (1 - $s * $f);
$k = $v * (1 - $s * (1 - $f));

$r = 255;
$g = 255;
$b = 255;
$r = 1;
$g = 1;
$b = 1;

switch ($i)
{
Expand Down

0 comments on commit 8e6bc58

Please sign in to comment.