UNPKG

3.94 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.brightYellow
10 }
11
12 , 'Identifier': {
13 'undefined' : colors.brightMagenta
14 , 'self' : colors.brightRed
15 , 'console' : undefined
16 , 'log' : colors.brightYellow
17 , 'warn' : colors.brightYellow
18 , 'error' : colors.brightYellow
19 , _default : undefined
20 }
21
22 , 'Null': {
23 _default: colors.brightMagenta
24 }
25
26 , 'Numeric': {
27 _default: colors.brightBlue
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.brightBlue(s)
37 : colors.brightGreen(s);
38 }
39 }
40
41 , 'Keyword': {
42 'break' : undefined
43
44 , 'case' : undefined
45 , 'catch' : undefined
46 , 'class' : undefined
47 , 'const' : undefined
48 , 'continue' : undefined
49
50 , 'debugger' : undefined
51 , 'default' : undefined
52 , 'delete' : undefined
53 , 'do' : undefined
54
55 , 'else' : undefined
56 , 'export' : undefined
57 , 'extends' : undefined
58
59 , 'finally' : undefined
60 , 'for' : undefined
61 , 'function' : colors.brightMagenta
62
63 , 'if' : undefined
64 , 'import' : undefined
65 , 'in' : undefined
66 , 'instanceof' : colors.brightMagenta
67 , 'let' : undefined
68 , 'new' : colors.brightRed
69 , 'return' : colors.brigntMagenta
70 , 'static' : undefined
71 , 'super' : undefined
72 , 'switch' : undefined
73
74 , 'this' : undefined
75 , 'throw' : undefined
76 , 'try' : undefined
77 , 'typeof' : undefined
78
79 , 'var' : colors.brightCyan
80 , 'void' : undefined
81
82 , 'while' : undefined
83 , 'with' : undefined
84 , 'yield' : undefined
85 , _default : colors.brightCyan
86 }
87 , 'Punctuator': {
88 ';': undefined
89 , '.': undefined
90 , ',': undefined
91
92 , '{': undefined
93 , '}': undefined
94 , '(': undefined
95 , ')': undefined
96 , '[': undefined
97 , ']': undefined
98
99 , '<': colors.brightMagenta
100 , '>': colors.brightMagenta
101 , '+': colors.brightMagenta
102 , '-': colors.brightMagenta
103 , '*': colors.brightMagenta
104 , '%': colors.brightMagenta
105 , '&': colors.brightMagenta
106 , '|': colors.brightMagenta
107 , '^': colors.brightMagenta
108 , '!': colors.brightMagenta
109 , '~': colors.brightMagenta
110 , '?': colors.brightMagenta
111 , ':': undefined
112 , '=': colors.brightMagenta
113
114 , '<=': colors.brighYellow
115 , '>=': colors.brighYellow
116 , '==': colors.brighYellow
117 , '!=': colors.brighYellow
118 , '++': colors.brighYellow
119 , '--': colors.brighYellow
120 , '<<': colors.brighYellow
121 , '>>': colors.brighYellow
122 , '&&': colors.brighYellow
123 , '||': colors.brighYellow
124 , '+=': colors.brighYellow
125 , '-=': colors.brighYellow
126 , '*=': colors.brighYellow
127 , '%=': colors.brighYellow
128 , '&=': colors.brighYellow
129 , '|=': colors.brighYellow
130 , '^=': colors.brighYellow
131 , '/=': colors.brighYellow
132 , '=>': colors.brighYellow
133
134 , '===': colors.brightCyan
135 , '!==': colors.brightCyan
136 , '>>>': colors.brightCyan
137 , '<<=': colors.brightCyan
138 , '>>=': colors.brightCyan
139 , '...': colors.brightCyan
140
141 , '>>>=': colors.cyan
142
143 , _default: undefined
144 }
145
146 // line comment
147 , Line: {
148 _default: colors.white
149 }
150
151 /* block comment */
152 , Block: {
153 _default: colors.white
154 }
155
156 , _default: undefined
157};