mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 14:41:28 +00:00
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:
committed by
Klaas Pieter Annema
parent
ce2c662872
commit
c78b5e580a
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user