diff options
author | Laurențiu Nicola <[email protected]> | 2019-05-21 12:04:54 +0100 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2019-05-21 12:19:08 +0100 |
commit | 9ade271a67a9fae0d89f8138970679c9730e9fce (patch) | |
tree | 7a3cc5a13d3d71d0d247f5d0b86ecdabfc9f8f35 /editors/code/src | |
parent | eabfe3902f363ee03bef8421580c6fe8e3730899 (diff) |
Use ThemeColor and add support for light themes
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/highlighting.ts | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index 2521dff62..432f40ff4 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts | |||
@@ -13,23 +13,32 @@ export class Highlighter { | |||
13 | string, | 13 | string, |
14 | vscode.TextEditorDecorationType | 14 | vscode.TextEditorDecorationType |
15 | > { | 15 | > { |
16 | const decor = (color: string) => | 16 | const colorContrib = ( |
17 | vscode.window.createTextEditorDecorationType({ color }); | 17 | tag: string |
18 | ): [string, vscode.TextEditorDecorationType] => { | ||
19 | const color = new vscode.ThemeColor('ralsp.' + tag); | ||
20 | const decor = vscode.window.createTextEditorDecorationType({ | ||
21 | color | ||
22 | }); | ||
23 | return [tag, decor]; | ||
24 | }; | ||
18 | 25 | ||
19 | const decorations: Iterable< | 26 | const decorations: Iterable< |
20 | [string, vscode.TextEditorDecorationType] | 27 | [string, vscode.TextEditorDecorationType] |
21 | > = [ | 28 | > = [ |
22 | ['background', decor('#3F3F3F')], | 29 | colorContrib('background'), |
23 | ['comment', decor('#7F9F7F')], | 30 | colorContrib('comment'), |
24 | ['string', decor('#CC9393')], | 31 | colorContrib('string'), |
25 | ['keyword', decor('#F0DFAF')], | 32 | colorContrib('unsafe'), |
26 | ['function', decor('#93E0E3')], | 33 | colorContrib('keyword'), |
27 | ['parameter', decor('#94BFF3')], | 34 | colorContrib('control'), |
28 | ['builtin', decor('#DD6718')], | 35 | colorContrib('function'), |
29 | ['text', decor('#DCDCCC')], | 36 | colorContrib('parameter'), |
30 | ['attribute', decor('#BFEBBF')], | 37 | colorContrib('builtin'), |
31 | ['literal', decor('#DFAF8F')], | 38 | colorContrib('text'), |
32 | ['macro', decor('#DFAF8F')] | 39 | colorContrib('attribute'), |
40 | colorContrib('literal'), | ||
41 | colorContrib('macro') | ||
33 | ]; | 42 | ]; |
34 | 43 | ||
35 | return new Map<string, vscode.TextEditorDecorationType>(decorations); | 44 | return new Map<string, vscode.TextEditorDecorationType>(decorations); |