本文整理汇总了TypeScript中vs/platform/state/common/state.IStateService类的典型用法代码示例。如果您正苦于以下问题:TypeScript IStateService类的具体用法?TypeScript IStateService怎么用?TypeScript IStateService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IStateService类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getBackgroundColor
export function getBackgroundColor(stateService: IStateService): string {
if (isWindows && systemPreferences.isInvertedColorScheme()) {
return DEFAULT_BG_HC_BLACK;
}
let background = stateService.getItem<string>(THEME_BG_STORAGE_KEY, null);
if (!background) {
let baseTheme: string;
if (isWindows && systemPreferences.isInvertedColorScheme()) {
baseTheme = 'hc-black';
} else {
baseTheme = stateService.getItem<string>(THEME_STORAGE_KEY, 'vs-dark').split(' ')[0];
}
background = (baseTheme === 'hc-black') ? DEFAULT_BG_HC_BLACK : (baseTheme === 'vs' ? DEFAULT_BG_LIGHT : DEFAULT_BG_DARK);
}
if (isMacintosh && background.toUpperCase() === DEFAULT_BG_DARK) {
background = '#171717'; // https://github.com/electron/electron/issues/5150
}
return background;
}
示例2: storeBackgroundColor
export function storeBackgroundColor(stateService: IStateService, data: { baseTheme: string, background: string }): void {
stateService.setItem(THEME_STORAGE_KEY, data.baseTheme);
stateService.setItem(THEME_BG_STORAGE_KEY, data.background);
}