reduce color in program._attr.
This commit is contained in:
parent
e506412f93
commit
82d4355517
|
@ -203,6 +203,17 @@ exports.blend._cache = {};
|
|||
|
||||
exports._cache = {};
|
||||
|
||||
exports.reduce = function(color, total) {
|
||||
if (color >= 16 && total <= 16) {
|
||||
color = exports.ccolors[color];
|
||||
} else if (color >= 8 && total <= 8) {
|
||||
color -= 8;
|
||||
} else if (color >= 2 && total <= 2) {
|
||||
color %= 2;
|
||||
}
|
||||
return color;
|
||||
};
|
||||
|
||||
// XTerm Colors
|
||||
// These were actually tough to track down. The xterm source only uses color
|
||||
// keywords. The X11 source needed to be examined to find the actual values.
|
||||
|
|
|
@ -2686,6 +2686,8 @@ Program.prototype._attr = function(param, val) {
|
|||
return this._attr('default ' + m[2]);
|
||||
}
|
||||
|
||||
color = colors.reduce(color, this.tput.colors);
|
||||
|
||||
if (color < 16 || (this.tput && this.tput.colors <= 16)) {
|
||||
if (m[2] === 'fg') {
|
||||
if (color < 8) {
|
||||
|
|
|
@ -1336,15 +1336,8 @@ Screen.prototype.draw = function(start, end) {
|
|||
// this.emit('draw');
|
||||
};
|
||||
|
||||
Screen.prototype._reduceColor = function(col) {
|
||||
if (col >= 16 && this.tput.colors <= 16) {
|
||||
col = colors.ccolors[col];
|
||||
} else if (col >= 8 && this.tput.colors <= 8) {
|
||||
col -= 8;
|
||||
} else if (col >= 2 && this.tput.colors <= 2) {
|
||||
col %= 2;
|
||||
}
|
||||
return col;
|
||||
Screen.prototype._reduceColor = function(color) {
|
||||
return colors.reduce(color, this.tput.colors);
|
||||
};
|
||||
|
||||
// Convert an SGR string to our own attribute format.
|
||||
|
|
Loading…
Reference in New Issue