-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.js
30 lines (23 loc) · 863 Bytes
/
extension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const vscode = require('vscode');
const DEFAULT_COLOR = vscode.workspace.getConfiguration('workbench').get('colorTheme');
const listener = function(event) {
let color = DEFAULT_COLOR;
const activePath = vscode.window.activeTextEditor.document.fileName;
const config = vscode.workspace.getConfiguration('themedFolders').get('paths');
const matches = Object.keys(config).filter(path => activePath.indexOf(path) > -1);
if (matches.length > 0) {
color = config[matches[0]];
}
vscode.workspace.getConfiguration('workbench').update('colorTheme', color);
}
function activate(context) {
context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(listener));
}
exports.activate = activate;
function deactivate() {
vscode.workspace.getConfiguration('workbench').update('colorTheme', DEFAULT_COLOR);
}
module.exports = {
activate,
deactivate
}