Only apply the selection hack for the WebGL renderer

This commit is contained in:
Juan Campa
2019-01-21 18:56:54 -05:00
parent 62ac714d38
commit 3077ae5311
2 changed files with 11 additions and 9 deletions
+10 -9
View File
@@ -121,15 +121,7 @@ export class ColorManager implements IColorManager {
this.colors.background = this._parseColor(theme.background, DEFAULT_BACKGROUND);
this.colors.cursor = this._parseColor(theme.cursor, DEFAULT_CURSOR, true);
this.colors.cursorAccent = this._parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT, true);
// HACK: while webgl renderer adds support for selection colors
// this.colors.selection = this._parseColor(theme.selection, DEFAULT_SELECTION, true);
if (this.getLuminance(this.colors.background) > 0.5) {
this.colors.selection = this._parseColor('#000', DEFAULT_SELECTION, true);
} else {
this.colors.selection = this._parseColor('#fff', DEFAULT_SELECTION, true);
}
this.colors.selection = this._parseColor(theme.selection, DEFAULT_SELECTION, true);
this.colors.ansi[0] = this._parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);
this.colors.ansi[1] = this._parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);
this.colors.ansi[2] = this._parseColor(theme.green, DEFAULT_ANSI_COLORS[2]);
@@ -148,6 +140,15 @@ export class ColorManager implements IColorManager {
this.colors.ansi[15] = this._parseColor(theme.brightWhite, DEFAULT_ANSI_COLORS[15]);
}
public applyWebglSelectionColorHack() {
// HACK: while webgl renderer adds support for selection colors
if (this.getLuminance(this.colors.background) > 0.5) {
this.colors.selection = this._parseColor('#000', DEFAULT_SELECTION, true);
} else {
this.colors.selection = this._parseColor('#fff', DEFAULT_SELECTION, true);
}
}
private _parseColor(
css: string,
fallback: IColor,
+1
View File
@@ -52,6 +52,7 @@ export class WebglRenderer extends EventEmitter implements IRenderer {
this.colorManager = new ColorManager(document, allowTransparency);
if (theme) {
this.colorManager.setTheme(theme);
this.colorManager.applyWebglSelectionColorHack();
}
this._renderLayers = [