From c78b5e580ac5c0aaa76861c16b4f4bc3ce2bbc7c Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Thu, 9 Sep 2010 10:01:14 -0700 Subject: [PATCH] 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) --- AppKit/CPColor.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPColor.j b/AppKit/CPColor.j index 0be27ab44..3309c2d5c 100644 --- a/AppKit/CPColor.j +++ b/AppKit/CPColor.j @@ -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);