Use ThemeColor and add support for light themes

This commit is contained in:
Laurențiu Nicola 2019-05-21 14:04:54 +03:00
parent eabfe3902f
commit 9ade271a67
3 changed files with 152 additions and 14 deletions

View file

@ -13,23 +13,32 @@ export class Highlighter {
string,
vscode.TextEditorDecorationType
> {
const decor = (color: string) =>
vscode.window.createTextEditorDecorationType({ color });
const colorContrib = (
tag: string
): [string, vscode.TextEditorDecorationType] => {
const color = new vscode.ThemeColor('ralsp.' + tag);
const decor = vscode.window.createTextEditorDecorationType({
color
});
return [tag, decor];
};
const decorations: Iterable<
[string, vscode.TextEditorDecorationType]
> = [
['background', decor('#3F3F3F')],
['comment', decor('#7F9F7F')],
['string', decor('#CC9393')],
['keyword', decor('#F0DFAF')],
['function', decor('#93E0E3')],
['parameter', decor('#94BFF3')],
['builtin', decor('#DD6718')],
['text', decor('#DCDCCC')],
['attribute', decor('#BFEBBF')],
['literal', decor('#DFAF8F')],
['macro', decor('#DFAF8F')]
colorContrib('background'),
colorContrib('comment'),
colorContrib('string'),
colorContrib('unsafe'),
colorContrib('keyword'),
colorContrib('control'),
colorContrib('function'),
colorContrib('parameter'),
colorContrib('builtin'),
colorContrib('text'),
colorContrib('attribute'),
colorContrib('literal'),
colorContrib('macro')
];
return new Map<string, vscode.TextEditorDecorationType>(decorations);