diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-21 14:58:42 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-21 14:58:42 +0100 |
commit | 51e82fe6d2edd7ca66944540bdbbc8cb39e4b5d2 (patch) | |
tree | 4ba523d010901e2c68d2901217074494d01c22d1 /editors/code/src | |
parent | c6a5d871d7a670473a78e03852bb158f3b6d5be3 (diff) | |
parent | b08362f6d2973336764c52ebc7cc5e9f34f0d80a (diff) |
Merge #1299
1299: Use ThemeColor and add support for light themes r=matklad a=lnicola
Part of #1294.
- switch to `ThemeColor`
- add light and high contrast theme definitions
- highlight control flow keywords and `unsafe`
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/highlighting.ts | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index 2521dff62..e1a68544a 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts | |||
@@ -13,23 +13,31 @@ 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('comment'), |
23 | ['comment', decor('#7F9F7F')], | 30 | colorContrib('string'), |
24 | ['string', decor('#CC9393')], | 31 | colorContrib('keyword'), |
25 | ['keyword', decor('#F0DFAF')], | 32 | colorContrib('keyword.control'), |
26 | ['function', decor('#93E0E3')], | 33 | colorContrib('keyword.unsafe'), |
27 | ['parameter', decor('#94BFF3')], | 34 | colorContrib('function'), |
28 | ['builtin', decor('#DD6718')], | 35 | colorContrib('parameter'), |
29 | ['text', decor('#DCDCCC')], | 36 | colorContrib('builtin'), |
30 | ['attribute', decor('#BFEBBF')], | 37 | colorContrib('text'), |
31 | ['literal', decor('#DFAF8F')], | 38 | colorContrib('attribute'), |
32 | ['macro', decor('#DFAF8F')] | 39 | colorContrib('literal'), |
40 | colorContrib('macro') | ||
33 | ]; | 41 | ]; |
34 | 42 | ||
35 | return new Map<string, vscode.TextEditorDecorationType>(decorations); | 43 | return new Map<string, vscode.TextEditorDecorationType>(decorations); |