vsc-material-theme/extensions/material.theme.config.ts

40 lines
1.2 KiB
TypeScript
Raw Normal View History

2017-05-28 16:50:44 +02:00
import * as vscode from 'vscode';
import { IGenericObject } from "./interfaces/igeneric-object";
import { THEME_ACCENTS_SETTER } from "./commands/accents-setter/index";
import { THEME_VARIANT } from "./commands/theme-variant/index";
2017-05-28 16:50:44 +02:00
enum Commands {
ACCENTS,
COLOUR_VARIANT
2017-05-28 16:50:44 +02:00
}
const OPTIONS: IGenericObject<number> = {
'Change accent color': Commands.ACCENTS,
'Change color variant': Commands.COLOUR_VARIANT
2017-05-28 16:50:44 +02:00
}
export function activate(context: vscode.ExtensionContext) {
if (vscode.workspace.getConfiguration().has('materialTheme.cache.workbench.accent')) {
vscode.workspace.getConfiguration().update('materialTheme.cache.workbench.accent', undefined, true);
}
2017-05-28 16:50:44 +02:00
// registering the command
let command = vscode.commands.registerCommand('material.theme.config', () => {
// the user is going to choose what aspect of theme to config
vscode.window.showQuickPick(Object.keys(OPTIONS)).then(response => {
// switching selected option
switch(OPTIONS[response]) {
2017-05-29 18:01:55 +02:00
case Commands.ACCENTS:
THEME_ACCENTS_SETTER();
2017-05-28 16:50:44 +02:00
break;
case Commands.COLOUR_VARIANT:
THEME_VARIANT();
break;
2017-05-28 16:50:44 +02:00
}
});
});
2017-05-28 16:50:44 +02:00
context.subscriptions.push(command);
}