UNPKG

4.52 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 ';': colors.brightBlack
95 , '.': colors.green
96 , ',': colors.green
97
98 , '{': colors.yellow
99 , '}': colors.yellow
100 , '(': colors.brightBlack
101 , ')': colors.brightBlack
102 , '[': colors.yellow
103 , ']': colors.yellow
104
105 , '<': undefined
106 , '>': undefined
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
120 , '<=': undefined
121 , '>=': undefined
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
141 , '===': undefined
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 // JSX
165 , JSXAttribute: {
166 _default: colors.magenta
167 }
168 , JSXClosingElement: {
169 _default: colors.magenta
170 }
171 , JSXElement: {
172 _default: colors.magenta
173 }
174 , JSXEmptyExpression: {
175 _default: colors.magenta
176 }
177 , JSXExpressionContainer: {
178 _default: colors.magenta
179 }
180 , JSXIdentifier: {
181 className: colors.blue
182 , _default: colors.magenta
183 }
184 , JSXMemberExpression: {
185 _default: colors.magenta
186 }
187 , JSXNamespacedName: {
188 _default: colors.magenta
189 }
190 , JSXOpeningElement: {
191 _default: colors.magenta
192 }
193 , JSXSpreadAttribute: {
194 _default: colors.magenta
195 }
196 , JSXText: {
197 _default: colors.brightGreen
198 }
199
200 , _default: undefined
201}