-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extended syntax colours with switch for win / other
- Loading branch information
1 parent
d0012a7
commit 69b4dbe
Showing
3 changed files
with
171 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
var colors = require('ansicolors'); | ||
|
||
// Change the below definitions in order to tweak the color theme. | ||
module.exports = { | ||
|
||
'Boolean': { | ||
'true' : undefined | ||
, 'false' : undefined | ||
, _default : colors.brightYellow | ||
} | ||
|
||
, 'Identifier': { | ||
'undefined' : colors.brightMagenta | ||
, 'self' : colors.brightRed | ||
, 'console' : undefined | ||
, 'log' : colors.brightYellow | ||
, 'warn' : colors.brightYellow | ||
, 'error' : colors.brightYellow | ||
, _default : undefined | ||
} | ||
|
||
, 'Null': { | ||
_default: colors.brightMagenta | ||
} | ||
|
||
, 'Numeric': { | ||
_default: colors.brightBlue | ||
} | ||
|
||
, 'String': { | ||
_default: function (s, info) { | ||
var nextToken = info.tokens[info.tokenIndex + 1]; | ||
|
||
// show keys of object literals and json in different color | ||
return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':') | ||
? colors.brightBlue(s) | ||
: colors.brightGreen(s); | ||
} | ||
} | ||
|
||
, 'Keyword': { | ||
'break' : undefined | ||
|
||
, 'case' : undefined | ||
, 'catch' : undefined | ||
, 'class' : undefined | ||
, 'const' : undefined | ||
, 'continue' : undefined | ||
|
||
, 'debugger' : undefined | ||
, 'default' : undefined | ||
, 'delete' : undefined | ||
, 'do' : undefined | ||
|
||
, 'else' : undefined | ||
, 'export' : undefined | ||
, 'extends' : undefined | ||
|
||
, 'finally' : undefined | ||
, 'for' : undefined | ||
, 'function' : colors.brightMagenta | ||
|
||
, 'if' : undefined | ||
, 'import' : undefined | ||
, 'in' : undefined | ||
, 'instanceof' : colors.brightMagenta | ||
, 'let' : undefined | ||
, 'new' : colors.brightRed | ||
, 'return' : colors.brigntMagenta | ||
, 'static' : undefined | ||
, 'super' : undefined | ||
, 'switch' : undefined | ||
|
||
, 'this' : undefined | ||
, 'throw' : undefined | ||
, 'try' : undefined | ||
, 'typeof' : undefined | ||
|
||
, 'var' : colors.brightCyan | ||
, 'void' : undefined | ||
|
||
, 'while' : undefined | ||
, 'with' : undefined | ||
, 'yield' : undefined | ||
, _default : colors.brightCyan | ||
} | ||
, 'Punctuator': { | ||
';': undefined | ||
, '.': undefined | ||
, ',': undefined | ||
|
||
, '{': undefined | ||
, '}': undefined | ||
, '(': undefined | ||
, ')': undefined | ||
, '[': undefined | ||
, ']': undefined | ||
|
||
, '<': colors.brightMagenta | ||
, '>': colors.brightMagenta | ||
, '+': colors.brightMagenta | ||
, '-': colors.brightMagenta | ||
, '*': colors.brightMagenta | ||
, '%': colors.brightMagenta | ||
, '&': colors.brightMagenta | ||
, '|': colors.brightMagenta | ||
, '^': colors.brightMagenta | ||
, '!': colors.brightMagenta | ||
, '~': colors.brightMagenta | ||
, '?': colors.brightMagenta | ||
, ':': undefined | ||
, '=': colors.brightMagenta | ||
|
||
, '<=': colors.brighYellow | ||
, '>=': colors.brighYellow | ||
, '==': colors.brighYellow | ||
, '!=': colors.brighYellow | ||
, '++': colors.brighYellow | ||
, '--': colors.brighYellow | ||
, '<<': colors.brighYellow | ||
, '>>': colors.brighYellow | ||
, '&&': colors.brighYellow | ||
, '||': colors.brighYellow | ||
, '+=': colors.brighYellow | ||
, '-=': colors.brighYellow | ||
, '*=': colors.brighYellow | ||
, '%=': colors.brighYellow | ||
, '&=': colors.brighYellow | ||
, '|=': colors.brighYellow | ||
, '^=': colors.brighYellow | ||
, '/=': colors.brighYellow | ||
, '=>': colors.brighYellow | ||
|
||
, '===': colors.brightCyan | ||
, '!==': colors.brightCyan | ||
, '>>>': colors.brightCyan | ||
, '<<=': colors.brightCyan | ||
, '>>=': colors.brightCyan | ||
, '...': colors.brightCyan | ||
|
||
, '>>>=': colors.cyan | ||
|
||
, _default: undefined | ||
} | ||
|
||
// line comment | ||
, Line: { | ||
_default: colors.white | ||
} | ||
|
||
/* block comment */ | ||
, Block: { | ||
_default: colors.white | ||
} | ||
|
||
, _default: undefined | ||
}; |