Reliably convert colors to hex strings

Converting a hex string to CPColor and back to a hex string now returns
the same initial hex string. (Fixed an off-by-one error)
This commit is contained in:
Sami Samhuri
2010-09-10 10:01:57 +02:00
committed by Klaas Pieter Annema
parent ce2c662872
commit c78b5e580a
+1 -1
View File
@@ -736,7 +736,7 @@ var byteToHex = function(n)
if (!n || isNaN(n))
return "00";
n = ROUND(MIN(255, MAX(0, 256 * n)));
n = FLOOR(MIN(255, MAX(0, 256 * n)));
return hexCharacters.charAt((n - n % 16) / 16) +
hexCharacters.charAt(n % 16);