From d511e2ab72974919ddecf9299199fe8f5d35add3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20L=C3=B8we=20Jacobsen?= Date: Fri, 20 Mar 2015 14:15:39 +0100 Subject: [PATCH] Fix error where typ and from could have the same value --- colors.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/colors.js b/colors.js index b2d3e21..1feebb7 100644 --- a/colors.js +++ b/colors.js @@ -214,7 +214,9 @@ if (!ranges[typ][typ]) { // no alpha|HEX if (type !== typ && typ !== 'XYZ') { from = exceptions[typ] || 'rgb'; - colors[typ] = convert[from + '2' + typ](colors[from]); + if (typ !== from) { + colors[typ] = convert[from + '2' + typ](colors[from]); + } } if (!RND[typ]) RND[typ] = {}; @@ -688,4 +690,4 @@ // return Math.max(min, Math.min(max, value)); // faster?? return (value > max ? max : value < min ? min : value); } -})(window); \ No newline at end of file +})(window);