colors.js refactor.

This commit is contained in:
Christopher Jeffrey 2013-06-16 10:49:50 -05:00
parent 188561c9ca
commit f59f7dc0e0
1 changed files with 4 additions and 9 deletions

View File

@ -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