Files
azuredatastudio/src/vs/workbench/api/common/extHostTheming.ts
Anthony Dresser 74caccdfe6 Merge from vscode 4f85c3c94c15457e1d4c9e67da6800630394ea54 (#8757)
* Merge from vscode 4f85c3c94c15457e1d4c9e67da6800630394ea54

* disable failing tests
2019-12-19 23:41:55 -08:00

39 lines
1.4 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ColorTheme, ColorThemeKind } from './extHostTypes';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { ExtHostThemingShape } from 'vs/workbench/api/common/extHost.protocol';
import { Emitter, Event } from 'vs/base/common/event';
export class ExtHostTheming implements ExtHostThemingShape {
readonly _serviceBrand: undefined;
private _actual: ColorTheme;
private _onDidChangeActiveColorTheme: Emitter<ColorTheme>;
constructor(
@IExtHostRpcService _extHostRpc: IExtHostRpcService
) {
this._actual = new ColorTheme(ColorThemeKind.Dark);
this._onDidChangeActiveColorTheme = new Emitter<ColorTheme>();
}
public get activeColorTheme(): ColorTheme {
return this._actual;
}
$onColorThemeChange(type: string): void {
let kind = type === 'light' ? ColorThemeKind.Light : type === 'dark' ? ColorThemeKind.Dark : ColorThemeKind.HighContrast;
this._actual = new ColorTheme(kind);
this._onDidChangeActiveColorTheme.fire(this._actual);
}
public get onDidChangeActiveColorTheme(): Event<ColorTheme> {
return this._onDidChangeActiveColorTheme.event;
}
}