Skip to content

Commit 1af6175

Browse files
authored
Merge pull request #3964 from Tyriar/selection_inconsistency
Rename ITheme.selection to selectionBackground
2 parents df14ce4 + 906a6fc commit 1af6175

File tree

12 files changed

+21
-21
lines changed

12 files changed

+21
-21
lines changed

addons/xterm-addon-canvas/src/SelectionRenderLayer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class SelectionRenderLayer extends BaseRenderLayer {
8585
return;
8686
}
8787

88-
this._ctx.fillStyle = this._colors.selectionTransparent.css;
88+
this._ctx.fillStyle = this._colors.selectionBackgroundTransparent.css;
8989

9090
if (columnSelectMode) {
9191
const startCol = start[0];

addons/xterm-addon-canvas/src/atlas/CharAtlasUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function generateConfig(scaledCharWidth: number, scaledCharHeight: number
1515
background: colors.background,
1616
cursor: undefined,
1717
cursorAccent: undefined,
18-
selection: undefined,
18+
selectionBackground: undefined,
1919
ansi: colors.ansi.slice()
2020
};
2121
return {

addons/xterm-addon-webgl/src/WebglRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
405405

406406
// Apply the selection color if needed
407407
if (this._isCellSelected(x, y)) {
408-
bgOverride = this._colors.selectionOpaque.rgba >> 8 & 0xFFFFFF;
408+
bgOverride = this._colors.selectionBackgroundOpaque.rgba >> 8 & 0xFFFFFF;
409409
if (this._colors.selectionForeground) {
410410
fgOverride = this._colors.selectionForeground.rgba >> 8 & 0xFFFFFF;
411411
}

addons/xterm-addon-webgl/src/atlas/CharAtlasUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export function generateConfig(scaledCellWidth: number, scaledCellHeight: number
2121
background: colors.background,
2222
cursor: NULL_COLOR,
2323
cursorAccent: NULL_COLOR,
24-
selectionTransparent: NULL_COLOR,
25-
selectionOpaque: NULL_COLOR,
24+
selectionBackgroundTransparent: NULL_COLOR,
25+
selectionBackgroundOpaque: NULL_COLOR,
2626
selectionForeground: NULL_COLOR,
2727
// For the static char atlas, we only use the first 16 colors, but we need all 256 for the
2828
// dynamic character atlas.

addons/xterm-addon-webgl/test/WebglRenderer.api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ describe('WebGL Renderer Integration Tests', async () => {
832832
});
833833
});
834834

835-
describe('selection', async () => {
835+
describe('selectionBackground', async () => {
836836
if (areTestsEnabled) {
837837
before(async () => setupBrowser());
838838
after(async () => browser.close());
@@ -843,7 +843,7 @@ describe('WebGL Renderer Integration Tests', async () => {
843843
const theme: ITheme = {
844844
foreground: '#FF0000',
845845
background: '#00FF00',
846-
selection: '#0000FF'
846+
selectionBackground: '#0000FF'
847847
};
848848
await page.evaluate(`window.term.options.theme = ${JSON.stringify(theme)};`);
849849
await writeSync(page, ` █\\x1b[7m█\\x1b[0m`);

demo/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const paddingElement = <HTMLInputElement>document.getElementById('padding');
106106
const xtermjsTheme = {
107107
foreground: '#F8F8F8',
108108
background: '#2D2E2C',
109-
selection: '#5DA5D533',
109+
selectionBackground: '#5DA5D533',
110110
black: '#1E1E1D',
111111
brightBlack: '#262625',
112112
red: '#CE5C5C',

src/browser/ColorManager.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export class ColorManager implements IColorManager {
102102
background: DEFAULT_BACKGROUND,
103103
cursor: DEFAULT_CURSOR,
104104
cursorAccent: DEFAULT_CURSOR_ACCENT,
105-
selectionTransparent: DEFAULT_SELECTION,
106-
selectionOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
105+
selectionBackgroundTransparent: DEFAULT_SELECTION,
106+
selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
107107
selectionForeground: undefined,
108108
ansi: DEFAULT_ANSI_COLORS.slice(),
109109
contrastCache: this._contrastCache
@@ -132,8 +132,8 @@ export class ColorManager implements IColorManager {
132132
this.colors.background = this._parseColor(theme.background, DEFAULT_BACKGROUND);
133133
this.colors.cursor = this._parseColor(theme.cursor, DEFAULT_CURSOR, true);
134134
this.colors.cursorAccent = this._parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT, true);
135-
this.colors.selectionTransparent = this._parseColor(theme.selection, DEFAULT_SELECTION, true);
136-
this.colors.selectionOpaque = color.blend(this.colors.background, this.colors.selectionTransparent);
135+
this.colors.selectionBackgroundTransparent = this._parseColor(theme.selectionBackground, DEFAULT_SELECTION, true);
136+
this.colors.selectionBackgroundOpaque = color.blend(this.colors.background, this.colors.selectionBackgroundTransparent);
137137
const nullColor: IColor = {
138138
css: '',
139139
rgba: 0
@@ -147,9 +147,9 @@ export class ColorManager implements IColorManager {
147147
* If selection color is opaque, blend it with background with 0.3 opacity
148148
* Issue #2737
149149
*/
150-
if (color.isOpaque(this.colors.selectionTransparent)) {
150+
if (color.isOpaque(this.colors.selectionBackgroundTransparent)) {
151151
const opacity = 0.3;
152-
this.colors.selectionTransparent = color.opacity(this.colors.selectionTransparent, opacity);
152+
this.colors.selectionBackgroundTransparent = color.opacity(this.colors.selectionBackgroundTransparent, opacity);
153153
}
154154
this.colors.ansi = DEFAULT_ANSI_COLORS.slice();
155155
this.colors.ansi[0] = this._parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);

src/browser/Types.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ export interface IColorSet {
115115
background: IColor;
116116
cursor: IColor;
117117
cursorAccent: IColor;
118-
selectionTransparent: IColor;
118+
selectionBackgroundTransparent: IColor;
119119
/** The selection blended on top of background. */
120-
selectionOpaque: IColor;
120+
selectionBackgroundOpaque: IColor;
121121
selectionForeground: IColor | undefined;
122122
ansi: IColor[];
123123
contrastCache: IColorContrastCache;
@@ -136,7 +136,7 @@ export interface IPartialColorSet {
136136
background: IColor;
137137
cursor?: IColor;
138138
cursorAccent?: IColor;
139-
selection?: IColor;
139+
selectionBackground?: IColor;
140140
ansi: IColor[];
141141
}
142142

src/browser/renderer/dom/DomRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export class DomRenderer extends Disposable implements IRenderer {
222222
`}` +
223223
`${this._terminalSelector} .${SELECTION_CLASS} div {` +
224224
` position: absolute;` +
225-
` background-color: ${this._colors.selectionOpaque.css};` +
225+
` background-color: ${this._colors.selectionBackgroundOpaque.css};` +
226226
`}`;
227227
// Colors
228228
this._colors.ansi.forEach((c, i) => {

src/browser/renderer/dom/DomRendererRowFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export class DomRendererRowFactory {
218218
// If in the selection, force the element to be above the selection to improve contrast and
219219
// support opaque selections
220220
if (isInSelection) {
221-
bgOverride = this._colors.selectionOpaque;
221+
bgOverride = this._colors.selectionBackgroundOpaque;
222222
isTop = true;
223223
}
224224

0 commit comments

Comments
 (0)