UNPKG

3.86 kBJavaScriptView Raw
1var colors = require('ansicolors');
2
3// Change the below definitions in order to tweak the color theme.
4module.exports = {
5
6 'Boolean': {
7 'true' : undefined
8 , 'false' : undefined
9 , _default : colors.brightRed
10 }
11
12 , 'Identifier': {
13 'undefined' : colors.brightBlack
14 , 'self' : colors.brightRed
15 , 'console' : colors.blue
16 , 'log' : colors.blue
17 , 'warn' : colors.red
18 , 'error' : colors.brightRed
19 , _default : colors.white
20 }
21
22 , 'Null': {
23 _default: colors.brightBlack
24 }
25
26 , 'Numeric': {
27 _default: colors.blue
28 }
29
30 , 'String': {
31 _default: function (s, info) {
32 var nextToken = info.tokens[info.tokenIndex + 1];
33
34 // show keys of object literals and json in different color
35 return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':')
36 ? colors.green(s)
37 : colors.brightGreen(s);
38 }
39 }
40
41 , 'Keyword': {
42 'break' : undefined
43
44 , 'case' : undefined
45 , 'catch' : colors.cyan
46 , 'class' : undefined
47 , 'const' : undefined
48 , 'continue' : undefined
49
50 , 'debugger' : undefined
51 , 'default' : undefined
52 , 'delete' : colors.red
53 , 'do' : undefined
54
55 , 'else' : undefined
56 , 'enum' : undefined
57 , 'export' : undefined
58 , 'extends' : undefined
59
60 , 'finally' : colors.cyan
61 , 'for' : undefined
62 , 'function' : undefined
63
64 , 'if' : undefined
65 , 'implements' : undefined
66 , 'import' : undefined
67 , 'in' : undefined
68 , 'instanceof' : undefined
69 , 'let' : undefined
70 , 'new' : colors.red
71 , 'package' : undefined
72 , 'private' : undefined
73 , 'protected' : undefined
74 , 'public' : undefined
75 , 'return' : colors.red
76 , 'static' : undefined
77 , 'super' : undefined
78 , 'switch' : undefined
79
80 , 'this' : colors.brightRed
81 , 'throw' : undefined
82 , 'try' : colors.cyan
83 , 'typeof' : undefined
84
85 , 'var' : colors.green
86 , 'void' : undefined
87
88 , 'while' : undefined
89 , 'with' : undefined
90 , 'yield' : undefined
91 , _default : colors.brightBlue
92 }
93 , 'Punctuator': {
94 // setting semicolon's color to the same as the terminal background makes it invisible
95 ';': colors.black
96
97 , '.': colors.green
98 , ',': colors.green
99
100 , '{': colors.yellow
101 , '}': colors.yellow
102 , '(': colors.brightBlack
103 , ')': colors.brightBlack
104 , '[': colors.yellow
105 , ']': colors.yellow
106
107 , '<': undefined
108 , '>': undefined
109 , '+': undefined
110 , '-': undefined
111 , '*': undefined
112 , '%': undefined
113 , '&': undefined
114 , '|': undefined
115 , '^': undefined
116 , '!': undefined
117 , '~': undefined
118 , '?': undefined
119 , ':': undefined
120 , '=': undefined
121
122 , '<=': undefined
123 , '>=': undefined
124 , '==': undefined
125 , '!=': undefined
126 , '++': undefined
127 , '--': undefined
128 , '<<': undefined
129 , '>>': undefined
130 , '&&': undefined
131 , '||': undefined
132 , '+=': undefined
133 , '-=': undefined
134 , '*=': undefined
135 , '%=': undefined
136 , '&=': undefined
137 , '|=': undefined
138 , '^=': undefined
139 , '/=': undefined
140 , '=>': undefined
141
142 , '===': undefined
143 , '!==': undefined
144 , '>>>': undefined
145 , '<<=': undefined
146 , '>>=': undefined
147 , '...': undefined
148
149 , '>>>=': undefined
150
151 , _default: colors.brightYellow
152 }
153
154 // line comment
155 , Line: {
156 _default: colors.brightBlack
157 }
158
159 /* block comment */
160 , Block: {
161 _default: colors.brightBlack
162 }
163
164 , _default: undefined
165};