Skip to content

Commit e520fbe

Browse files
committed
adopt defaultThemeType in web
1 parent 76d6127 commit e520fbe

2 files changed

Lines changed: 6 additions & 21 deletions

File tree

src/vs/workbench/browser/web.main.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { mark } from 'vs/base/common/performance';
7-
import { domContentLoaded, addDisposableListener, EventType, addClass, EventHelper } from 'vs/base/browser/dom';
7+
import { domContentLoaded, addDisposableListener, EventType, EventHelper } from 'vs/base/browser/dom';
88
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
99
import { ILogService, ConsoleLogService, MultiplexLogService } from 'vs/platform/log/common/log';
1010
import { ConsoleLogInAutomationService } from 'vs/platform/log/browser/log';
@@ -39,7 +39,6 @@ import { BACKUPS } from 'vs/platform/environment/common/environment';
3939
import { joinPath } from 'vs/base/common/resources';
4040
import { BrowserStorageService } from 'vs/platform/storage/browser/storageService';
4141
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
42-
import { getThemeTypeSelector, DARK, HIGH_CONTRAST, LIGHT } from 'vs/platform/theme/common/themeService';
4342
import { registerWindowDriver } from 'vs/platform/driver/browser/driver';
4443
import { BufferLogService } from 'vs/platform/log/common/bufferLog';
4544
import { FileLogService } from 'vs/platform/log/common/fileLogService';
@@ -74,9 +73,6 @@ class BrowserMain extends Disposable {
7473
await domContentLoaded();
7574
mark('willStartWorkbench');
7675

77-
// Base Theme
78-
this.restoreBaseTheme();
79-
8076
// Create Workbench
8177
const workbench = new Workbench(
8278
this.domElement,
@@ -131,7 +127,6 @@ class BrowserMain extends Disposable {
131127
}));
132128
this._register(workbench.onWillShutdown(() => {
133129
storageService.close();
134-
this.saveBaseTheme();
135130
}));
136131
this._register(workbench.onShutdown(() => this.dispose()));
137132

@@ -147,21 +142,6 @@ class BrowserMain extends Disposable {
147142
});
148143
}
149144

150-
private restoreBaseTheme(): void {
151-
addClass(this.domElement, window.localStorage.getItem('vscode.baseTheme') || getThemeTypeSelector(LIGHT) /* Fallback to a light theme by default on web */);
152-
}
153-
154-
private saveBaseTheme(): void {
155-
const classes = this.domElement.className;
156-
const baseThemes = [DARK, LIGHT, HIGH_CONTRAST].map(baseTheme => getThemeTypeSelector(baseTheme));
157-
for (const baseTheme of baseThemes) {
158-
if (classes.indexOf(baseTheme) >= 0) {
159-
window.localStorage.setItem('vscode.baseTheme', baseTheme);
160-
break;
161-
}
162-
}
163-
}
164-
165145
private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: BrowserStorageService }> {
166146
const serviceCollection = new ServiceCollection();
167147

src/vs/workbench/services/environment/browser/environmentService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
1414
import product from 'vs/platform/product/common/product';
1515
import { memoize } from 'vs/base/common/decorators';
1616
import { onUnexpectedError } from 'vs/base/common/errors';
17+
import { LIGHT } from 'vs/platform/theme/common/themeService';
1718

1819
export class BrowserEnvironmentConfiguration implements IEnvironmentConfiguration {
1920

@@ -63,6 +64,10 @@ export class BrowserEnvironmentConfiguration implements IEnvironmentConfiguratio
6364
get highContrast() {
6465
return false; // could investigate to detect high contrast theme automatically
6566
}
67+
68+
get defaultThemeType() {
69+
return LIGHT;
70+
}
6671
}
6772

6873
interface IBrowserWorkbenchEnvironmentConstructionOptions extends IWorkbenchConstructionOptions {

0 commit comments

Comments
 (0)