vsc-material-theme/extensions/theme-setter/index.ts

18 lines
637 B
TypeScript
Raw Normal View History

2017-05-28 16:50:44 +02:00
import * as vscode from 'vscode';
import { THEMES } from './themes';
export const COMMAND_THEME_SETTER = () => {
vscode.window.showQuickPick(Object.keys(THEMES)).then(themeSelected => {
vscode.workspace.getConfiguration().update('workbench.colorTheme', THEMES[themeSelected], true).then(() => {
if (themeSelected === undefined) return;
vscode.window.showInformationMessage(`${ themeSelected } theme set.`);
}, () => {
if (themeSelected === undefined) return;
vscode.window.showErrorMessage(`Cannot set theme ${ themeSelected }, please report this bug to the Material theme devs.`);
});
});
};