colors.js refactor.
This commit is contained in:
parent
188561c9ca
commit
f59f7dc0e0
|
@ -14,15 +14,10 @@ exports.matchColor = function(col) {
|
||||||
return exports._cache[col];
|
return exports._cache[col];
|
||||||
}
|
}
|
||||||
|
|
||||||
var rgb = function(col) {
|
var col_ = parseInt(col.substring(1), 16)
|
||||||
var col = parseInt(col.substring(1), 16);
|
, r = (col_ >> 16) & 0xff
|
||||||
return [(col >> 16) & 0xff, (col >> 8) & 0xff, col & 0xff];
|
, g = (col_ >> 8) & 0xff
|
||||||
};
|
, b = col_ & 0xff
|
||||||
|
|
||||||
var col_ = rgb(col)
|
|
||||||
, r = col_[0]
|
|
||||||
, g = col_[1]
|
|
||||||
, b = col_[2]
|
|
||||||
, ldiff = Infinity
|
, ldiff = Infinity
|
||||||
, li = -1
|
, li = -1
|
||||||
, i = 0
|
, i = 0
|
||||||
|
|
Loading…
Reference in New Issue