From f59f7dc0e006f4ac102685a94bc233fcf8e846b6 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 16 Jun 2013 10:49:50 -0500 Subject: [PATCH] colors.js refactor. --- lib/colors.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/colors.js b/lib/colors.js index 44c3868..7b59e9a 100644 --- a/lib/colors.js +++ b/lib/colors.js @@ -14,15 +14,10 @@ exports.matchColor = function(col) { return exports._cache[col]; } - var rgb = function(col) { - var col = parseInt(col.substring(1), 16); - return [(col >> 16) & 0xff, (col >> 8) & 0xff, col & 0xff]; - }; - - var col_ = rgb(col) - , r = col_[0] - , g = col_[1] - , b = col_[2] + var col_ = parseInt(col.substring(1), 16) + , r = (col_ >> 16) & 0xff + , g = (col_ >> 8) & 0xff + , b = col_ & 0xff , ldiff = Infinity , li = -1 , i = 0