Small refactor
This commit is contained in:
parent
749b950f5f
commit
0733ceb3b6
@ -13699,20 +13699,17 @@
|
||||
};
|
||||
|
||||
Color.prototype.shiftRGB = function(shift, smart) {
|
||||
var color;
|
||||
var color, rgb, _i, _len, _ref;
|
||||
if (smart) {
|
||||
shift = (this.isLight ? -1 : 1) * Math.abs(shift);
|
||||
shift = (this.isLight() ? -1 : 1) * Math.abs(shift);
|
||||
}
|
||||
return ((function() {
|
||||
var _i, _len, _ref, _results;
|
||||
_ref = this.privateRGB;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
color = _ref[_i];
|
||||
_results.push(minmax(color + shift));
|
||||
}
|
||||
return _results;
|
||||
}).call(this)).join(",");
|
||||
rgb = [];
|
||||
_ref = this.privateRGB;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
color = _ref[_i];
|
||||
rgb.push(minmax(color + shift));
|
||||
}
|
||||
return rgb.join("");
|
||||
};
|
||||
|
||||
return Color;
|
||||
|
||||
@ -13710,20 +13710,17 @@
|
||||
};
|
||||
|
||||
Color.prototype.shiftRGB = function(shift, smart) {
|
||||
var color;
|
||||
var color, rgb, _i, _len, _ref;
|
||||
if (smart) {
|
||||
shift = (this.isLight ? -1 : 1) * Math.abs(shift);
|
||||
shift = (this.isLight() ? -1 : 1) * Math.abs(shift);
|
||||
}
|
||||
return ((function() {
|
||||
var _i, _len, _ref, _results;
|
||||
_ref = this.privateRGB;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
color = _ref[_i];
|
||||
_results.push(minmax(color + shift));
|
||||
}
|
||||
return _results;
|
||||
}).call(this)).join(",");
|
||||
rgb = [];
|
||||
_ref = this.privateRGB;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
color = _ref[_i];
|
||||
rgb.push(minmax(color + shift));
|
||||
}
|
||||
return rgb.join("");
|
||||
};
|
||||
|
||||
return Color;
|
||||
|
||||
@ -52,5 +52,7 @@ class Color
|
||||
isLight: -> (@privateRGB[0] * 0.299 + @privateRGB[1] * 0.587 + @privateRGB[2] * 0.114) > 125
|
||||
|
||||
shiftRGB: (shift, smart) ->
|
||||
shift = (if @isLight then -1 else 1) * Math.abs shift if smart
|
||||
return (minmax color + shift for color in @privateRGB).join ","
|
||||
shift = (if @isLight() then -1 else 1) * Math.abs shift if smart
|
||||
rgb = []
|
||||
rgb.push minmax color + shift for color in @privateRGB
|
||||
rgb.join ""
|
||||
Loading…
x
Reference in New Issue
Block a user