diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/package.json | 110 | ||||
-rw-r--r-- | editors/code/src/highlighting.ts | 34 |
2 files changed, 131 insertions, 13 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index 015b912b3..750c97bb1 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -268,6 +268,116 @@ | |||
268 | }, | 268 | }, |
269 | "pattern": "$rustc" | 269 | "pattern": "$rustc" |
270 | } | 270 | } |
271 | ], | ||
272 | "colors": [ | ||
273 | { | ||
274 | "id": "ralsp.comment", | ||
275 | "description": "Color for comments", | ||
276 | "defaults": { | ||
277 | "dark": "#6A9955", | ||
278 | "light": "#008000", | ||
279 | "highContrast": "#7CA668" | ||
280 | } | ||
281 | }, | ||
282 | { | ||
283 | "id": "ralsp.string", | ||
284 | "description": "Color for strings", | ||
285 | "defaults": { | ||
286 | "dark": "#CE9178", | ||
287 | "light": "#A31515", | ||
288 | "highContrast": "#CE9178" | ||
289 | } | ||
290 | }, | ||
291 | { | ||
292 | "id": "ralsp.keyword", | ||
293 | "description": "Color for keywords", | ||
294 | "defaults": { | ||
295 | "dark": "#569cd6", | ||
296 | "light": "#0000FF", | ||
297 | "highContrast": "#569CD6" | ||
298 | } | ||
299 | }, | ||
300 | { | ||
301 | "id": "ralsp.keyword.control", | ||
302 | "description": "Color for control keywords", | ||
303 | "defaults": { | ||
304 | "dark": "#C586C0", | ||
305 | "light": "#AF00DB", | ||
306 | "highContrast": "#C586C0" | ||
307 | } | ||
308 | }, | ||
309 | { | ||
310 | "id": "ralsp.keyword.unsafe", | ||
311 | "description": "Color for unsafe", | ||
312 | "defaults": { | ||
313 | "dark": "#FF3030", | ||
314 | "light": "#FF1010", | ||
315 | "highContrast": "#FF1010" | ||
316 | } | ||
317 | }, | ||
318 | { | ||
319 | "id": "ralsp.function", | ||
320 | "description": "Color for functions", | ||
321 | "defaults": { | ||
322 | "dark": "#DCDCAA", | ||
323 | "light": "#795E26", | ||
324 | "highContrast": "#DCDCAA" | ||
325 | } | ||
326 | }, | ||
327 | { | ||
328 | "id": "ralsp.parameter", | ||
329 | "description": "Color for parameters", | ||
330 | "defaults": { | ||
331 | "dark": "#9CDCFE", | ||
332 | "light": "#001080", | ||
333 | "highContrast": "#9CDCFE" | ||
334 | } | ||
335 | }, | ||
336 | { | ||
337 | "id": "ralsp.builtin", | ||
338 | "description": "Color for builtins", | ||
339 | "defaults": { | ||
340 | "dark": "#DD6718", | ||
341 | "light": "#DD6718", | ||
342 | "highContrast": "#DD6718" | ||
343 | } | ||
344 | }, | ||
345 | { | ||
346 | "id": "ralsp.text", | ||
347 | "description": "Color for text", | ||
348 | "defaults": { | ||
349 | "dark": "#D4D4D4", | ||
350 | "light": "#000000", | ||
351 | "highContrast": "#FFFFFF" | ||
352 | } | ||
353 | }, | ||
354 | { | ||
355 | "id": "ralsp.attribute", | ||
356 | "description": "Color for attributes", | ||
357 | "defaults": { | ||
358 | "dark": "#9FE9BF", | ||
359 | "light": "#1F4B1F", | ||
360 | "highContrast": "#108010" | ||
361 | } | ||
362 | }, | ||
363 | { | ||
364 | "id": "ralsp.literal", | ||
365 | "description": "Color for literals", | ||
366 | "defaults": { | ||
367 | "dark": "#BECEA8", | ||
368 | "light": "#09885A", | ||
369 | "highContrast": "#B5CEA8" | ||
370 | } | ||
371 | }, | ||
372 | { | ||
373 | "id": "ralsp.macro", | ||
374 | "description": "Color for DFAF8F", | ||
375 | "defaults": { | ||
376 | "dark": "#BFEBBF", | ||
377 | "light": "#DD6718", | ||
378 | "highContrast": "#ED7718" | ||
379 | } | ||
380 | } | ||
271 | ] | 381 | ] |
272 | } | 382 | } |
273 | } | 383 | } |
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); |