mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Only apply the selection hack for the WebGL renderer
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user