Why limit ourselves to two arguments?
This commit is contained in:
parent
4db1fcd38e
commit
0b2fcfc03f
@ -12652,25 +12652,22 @@
|
|||||||
node.disabled = true;
|
node.disabled = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
matrix: function(foreground, background) {
|
matrix: function() {
|
||||||
var bg, bgHex, fg, fgHex;
|
var arg, color, colors, hex, i, rgb, val, _i, _len;
|
||||||
|
|
||||||
fgHex = Style.colorToHex(foreground) || "ffffff";
|
colors = [];
|
||||||
fg = {
|
for (_i = 0, _len = arguments.length; _i < _len; _i++) {
|
||||||
r: parseInt(fgHex.substr(0, 2), 16) / 255,
|
arg = arguments[_i];
|
||||||
g: parseInt(fgHex.substr(2, 2), 16) / 255,
|
hex = Style.colorToHex(arg) || "ffffff";
|
||||||
b: parseInt(fgHex.substr(4, 2), 16) / 255
|
color = {};
|
||||||
};
|
rgb = ['r', 'g', 'b'];
|
||||||
if (background) {
|
i = 0;
|
||||||
bgHex = Style.colorToHex(background) || "000000";
|
while (val = rgb[i]) {
|
||||||
bg = {
|
color[val] = parseInt(hex.substr(2 * i++, 2), 16) / 255;
|
||||||
r: parseInt(bgHex.substr(0, 2), 16) / 255,
|
}
|
||||||
g: parseInt(bgHex.substr(2, 2), 16) / 255,
|
colors.push(color);
|
||||||
b: parseInt(bgHex.substr(4, 2), 16) / 255
|
|
||||||
};
|
|
||||||
return [fg, bg];
|
|
||||||
}
|
}
|
||||||
return [fg];
|
return colors;
|
||||||
},
|
},
|
||||||
filter: function(_arg) {
|
filter: function(_arg) {
|
||||||
var bg, fg;
|
var bg, fg;
|
||||||
|
|||||||
@ -12648,25 +12648,22 @@
|
|||||||
node.disabled = true;
|
node.disabled = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
matrix: function(foreground, background) {
|
matrix: function() {
|
||||||
var bg, bgHex, fg, fgHex;
|
var arg, color, colors, hex, i, rgb, val, _i, _len;
|
||||||
|
|
||||||
fgHex = Style.colorToHex(foreground) || "ffffff";
|
colors = [];
|
||||||
fg = {
|
for (_i = 0, _len = arguments.length; _i < _len; _i++) {
|
||||||
r: parseInt(fgHex.substr(0, 2), 16) / 255,
|
arg = arguments[_i];
|
||||||
g: parseInt(fgHex.substr(2, 2), 16) / 255,
|
hex = Style.colorToHex(arg) || "ffffff";
|
||||||
b: parseInt(fgHex.substr(4, 2), 16) / 255
|
color = {};
|
||||||
};
|
rgb = ['r', 'g', 'b'];
|
||||||
if (background) {
|
i = 0;
|
||||||
bgHex = Style.colorToHex(background) || "000000";
|
while (val = rgb[i]) {
|
||||||
bg = {
|
color[val] = parseInt(hex.substr(2 * i++, 2), 16) / 255;
|
||||||
r: parseInt(bgHex.substr(0, 2), 16) / 255,
|
}
|
||||||
g: parseInt(bgHex.substr(2, 2), 16) / 255,
|
colors.push(color);
|
||||||
b: parseInt(bgHex.substr(4, 2), 16) / 255
|
|
||||||
};
|
|
||||||
return [fg, bg];
|
|
||||||
}
|
}
|
||||||
return [fg];
|
return colors;
|
||||||
},
|
},
|
||||||
filter: function(_arg) {
|
filter: function(_arg) {
|
||||||
var bg, fg;
|
var bg, fg;
|
||||||
|
|||||||
@ -93,27 +93,18 @@ Style =
|
|||||||
node.disabled = true
|
node.disabled = true
|
||||||
return
|
return
|
||||||
|
|
||||||
matrix: (foreground, background) ->
|
matrix: ->
|
||||||
fgHex = Style.colorToHex(foreground) or "ffffff"
|
colors = []
|
||||||
|
for arg in arguments
|
||||||
|
hex = Style.colorToHex(arg) or "ffffff"
|
||||||
|
color = {}
|
||||||
|
rgb = ['r', 'g', 'b']
|
||||||
|
i = 0
|
||||||
|
while val = rgb[i]
|
||||||
|
color[val] = parseInt(hex.substr((2 * i++), 2), 16) / 255
|
||||||
|
colors.push color
|
||||||
|
|
||||||
fg = {
|
colors
|
||||||
r: parseInt(fgHex.substr(0, 2), 16) / 255
|
|
||||||
g: parseInt(fgHex.substr(2, 2), 16) / 255
|
|
||||||
b: parseInt(fgHex.substr(4, 2), 16) / 255
|
|
||||||
}
|
|
||||||
|
|
||||||
if background
|
|
||||||
bgHex = Style.colorToHex(background) or "000000"
|
|
||||||
|
|
||||||
bg = {
|
|
||||||
r: parseInt(bgHex.substr(0, 2), 16) / 255
|
|
||||||
g: parseInt(bgHex.substr(2, 2), 16) / 255
|
|
||||||
b: parseInt(bgHex.substr(4, 2), 16) / 255
|
|
||||||
}
|
|
||||||
|
|
||||||
return [fg, bg]
|
|
||||||
|
|
||||||
[fg]
|
|
||||||
|
|
||||||
filter: ([fg, bg]) ->
|
filter: ([fg, bg]) ->
|
||||||
"#{bg.r} #{-fg.r} 0 0 #{fg.r} #{bg.g} #{-fg.g} 0 0 #{fg.g} #{bg.b} #{-fg.b} 0 0 #{fg.b}"
|
"#{bg.r} #{-fg.r} 0 0 #{fg.r} #{bg.g} #{-fg.g} 0 0 #{fg.g} #{bg.b} #{-fg.b} 0 0 #{fg.b}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user