aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2019-05-21 12:04:54 +0100
committerLaurenČ›iu Nicola <[email protected]>2019-05-21 12:19:08 +0100
commit9ade271a67a9fae0d89f8138970679c9730e9fce (patch)
tree7a3cc5a13d3d71d0d247f5d0b86ecdabfc9f8f35 /editors
parenteabfe3902f363ee03bef8421580c6fe8e3730899 (diff)
Use ThemeColor and add support for light themes
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package.json119
-rw-r--r--editors/code/src/highlighting.ts35
2 files changed, 141 insertions, 13 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 015b912b3..c72037da9 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -268,6 +268,125 @@
268 }, 268 },
269 "pattern": "$rustc" 269 "pattern": "$rustc"
270 } 270 }
271 ],
272 "colors": [
273 {
274 "id": "ralsp.background",
275 "description": "Background color",
276 "defaults": {
277 "dark": "#3F3F3F",
278 "light": "#001080",
279 "highContrast": "#000000"
280 }
281 },
282 {
283 "id": "ralsp.comment",
284 "description": "Color for comments",
285 "defaults": {
286 "dark": "#7F9F7F",
287 "light": "#008000",
288 "highContrast": "#7CA668"
289 }
290 },
291 {
292 "id": "ralsp.string",
293 "description": "Color for strings",
294 "defaults": {
295 "dark": "#CC9393",
296 "light": "#A31515",
297 "highContrast": "#CE9178"
298 }
299 },
300 {
301 "id": "ralsp.unsafe",
302 "description": "Color for unsafe",
303 "defaults": {
304 "dark": "#FF3030",
305 "light": "#FF1010",
306 "highContrast": "#FF1010"
307 }
308 },
309 {
310 "id": "ralsp.keyword",
311 "description": "Color for keywords",
312 "defaults": {
313 "dark": "#F0DFAF",
314 "light": "#0000FF",
315 "highContrast": "#569CD6"
316 }
317 },
318 {
319 "id": "ralsp.control",
320 "description": "Color for control keywords",
321 "defaults": {
322 "dark": "#CF20FB",
323 "light": "#AF00DB",
324 "highContrast": "#C586C0"
325 }
326 },
327 {
328 "id": "ralsp.function",
329 "description": "Color for functions",
330 "defaults": {
331 "dark": "#93E0E3",
332 "light": "#795E26",
333 "highContrast": "#DCDCAA"
334 }
335 },
336 {
337 "id": "ralsp.parameter",
338 "description": "Color for parameters",
339 "defaults": {
340 "dark": "#94BFF3",
341 "light": "#001080",
342 "highContrast": "#9CDCFE"
343 }
344 },
345 {
346 "id": "ralsp.builtin",
347 "description": "Color for builtins",
348 "defaults": {
349 "dark": "#DD6718",
350 "light": "#DD6718",
351 "highContrast": "#DD6718"
352 }
353 },
354 {
355 "id": "ralsp.text",
356 "description": "Color for text",
357 "defaults": {
358 "dark": "#DCDCCC",
359 "light": "#000000",
360 "highContrast": "#FFFFFF"
361 }
362 },
363 {
364 "id": "ralsp.attribute",
365 "description": "Color for attributes",
366 "defaults": {
367 "dark": "#BFEBBF",
368 "light": "#1F4B1F",
369 "highContrast": "#108010"
370 }
371 },
372 {
373 "id": "ralsp.literal",
374 "description": "Color for literals",
375 "defaults": {
376 "dark": "#DFAF8F",
377 "light": "#09885A",
378 "highContrast": "#B5CEA8"
379 }
380 },
381 {
382 "id": "ralsp.macro",
383 "description": "Color for DFAF8F",
384 "defaults": {
385 "dark": "#BFEBBF",
386 "light": "#DD6718",
387 "highContrast": "#ED7718"
388 }
389 }
271 ] 390 ]
272 } 391 }
273} 392}
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);