Skip to content

Commit

Permalink
Merge pull request #3899 from Tyriar/3898
Browse files Browse the repository at this point in the history
Fix allowTransparency not working when set after ctor
  • Loading branch information
Tyriar authored Jul 11, 2022
2 parents c26f605 + e2b8002 commit 685822d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/browser/ColorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,14 @@ export class ColorManager implements IColorManager {
this._updateRestoreColors();
}

public onOptionsChange(key: string): void {
if (key === 'minimumContrastRatio') {
this._contrastCache.clear();
public onOptionsChange(key: string, value: any): void {
switch (key) {
case 'minimumContrastRatio':
this._contrastCache.clear();
break;
case 'allowTransparency':
this.allowTransparency = value;
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/browser/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ export class Terminal extends CoreTerminal implements ITerminal {

this._theme = this.options.theme || this._theme;
this._colorManager = new ColorManager(document, this.options.allowTransparency);
this.register(this.optionsService.onOptionChange(e => this._colorManager!.onOptionsChange(e)));
this.register(this.optionsService.onOptionChange(e => this._colorManager!.onOptionsChange(e, this.optionsService.rawOptions[e])));
this._colorManager.setTheme(this._theme);

this._characterJoinerService = this._instantiationService.createInstance(CharacterJoinerService);
Expand Down
2 changes: 1 addition & 1 deletion src/browser/Types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export interface IBrowser {

export interface IColorManager {
colors: IColorSet;
onOptionsChange(key: string): void;
onOptionsChange(key: string, value: any): void;
}

export interface IColorSet {
Expand Down

0 comments on commit 685822d

Please sign in to comment.