From 8e6bc583640d51abb2d1d798525711f05e91d8cd Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sun, 7 Dec 2014 13:18:34 +0100 Subject: [PATCH] fix hsv2hex method, allow 0 hue --- RandomColor.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/RandomColor.class.php b/RandomColor.class.php index b0d06db..368c042 100644 --- a/RandomColor.class.php +++ b/RandomColor.class.php @@ -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); } @@ -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; @@ -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) {