From 258939eb282387113cb68c04543e178a073ffb1a Mon Sep 17 00:00:00 2001 From: peterd Date: Tue, 19 Aug 2014 21:48:23 +0200 Subject: [PATCH] RND fix (for XYZ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed order of _valueRanges (Lab before XYZ) to get rounded values of XYZ in convertColors without having to calculate XYZ again… --- colors.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/colors.js b/colors.js index c565dda..eee8513 100644 --- a/colors.js +++ b/colors.js @@ -7,8 +7,8 @@ hsl: {h: [0, 360], s: [0, 100], l: [0, 100]}, cmy: {c: [0, 100], m: [0, 100], y: [0, 100]}, cmyk: {c: [0, 100], m: [0, 100], y: [0, 100], k: [0, 100]}, - XYZ: {X: [0, 100], Y: [0, 100], Z: [0, 100]}, Lab: {L: [0, 100], a: [-128, 127], b: [-128, 127]}, + XYZ: {X: [0, 100], Y: [0, 100], Z: [0, 100]}, alpha: {alpha: [0, 1]}, HEX: {HEX: [0, 16777215]} // maybe we don't need this }, @@ -116,7 +116,7 @@ types = type.split('2'), fromType = types[0], toType = types[1], - test = /(?:RG|HS|CM|LA)/, + test = /(?:RG|HS|CM|LA)/, normalizeFrom = test.test(fromType), normalizeTo = test.test(toType), exceptions = {LAB: 'Lab'}, @@ -222,7 +222,7 @@ */ for (var typ in ranges) { if (!ranges[typ][typ]) { // no alpha|HEX - if (type !== typ) { // && typ !== 'XYZ' + if (type !== typ && typ !== 'XYZ') { from = exceptions[typ] || 'rgb'; colors[typ] = convert[from + '2' + typ](colors[from]); }