Skip to content

Commit 982f241

Browse files
authored
Merge pull request #9 from mongodb-js/adapt-syntax-highlighting
change coloring to be closer to Node.js and do not use blue
2 parents 6325de3 + ab24168 commit 982f241

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

lib/highlight.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,29 @@
33
const emphasize = require('emphasize');
44
const chalk = require('chalk');
55

6-
const windows = process.platform === 'win32';
76
const sheet = (chalk) => ({
87
comment: chalk.gray,
98
quote: chalk.gray,
109

11-
keyword: chalk.green,
12-
addition: chalk.green,
10+
keyword: chalk.cyan,
11+
addition: chalk.cyan,
1312

14-
number: windows ? chalk.yellow : chalk.blue,
13+
number: chalk.yellow,
1514
string: chalk.green,
1615
'meta meta-string': chalk.cyan,
17-
literal: chalk.cyan,
16+
literal: chalk.yellow,
1817
doctag: chalk.cyan,
19-
regexp: chalk.cyan,
18+
regexp: chalk.red,
2019

21-
attribute: chalk.blue,
20+
attribute: chalk.yellow,
2221
attr: chalk.yellow,
2322
variable: chalk.yellow,
2423
'template-variable': chalk.yellow,
2524
'class title': chalk.yellow,
2625
'function title': chalk.yellow,
2726
type: chalk.yellow,
2827

29-
symbol: chalk.magenta,
28+
symbol: chalk.green,
3029
bullet: chalk.magenta,
3130
subst: chalk.magenta,
3231
meta: chalk.magenta,

test/index.spec.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,7 @@ test('full pass-through test', t => {
142142
output.setEncoding('utf8').on('data', data => {
143143
out += data;
144144
if (out.endsWith('\n') && !out.startsWith('<done>')) {
145-
if (process.platform === 'win32') {
146-
t.equal(out, '\x1b[1G\x1b[0Jtest-prompt > \x1b[15Gle\b\b\x1b[32mlet\x1b[39m foo = \x1b[33m1\x1b[39m\x1b[33m2\x1b[39m\r\n');
147-
} else {
148-
t.equal(out, '\x1b[1G\x1b[0Jtest-prompt > \x1b[15Gle\b\b\x1b[32mlet\x1b[39m foo = \x1b[34m1\x1b[39m\x1b[34m2\x1b[39m\r\n');
149-
}
145+
t.equal(out, '\x1b[1G\x1b[0Jtest-prompt > \x1b[15Gle\b\b\x1b[36mlet\x1b[39m foo = \x1b[33m1\x1b[39m\x1b[33m2\x1b[39m\r\n');
150146
out = '<done>';
151147
}
152148
});

0 commit comments

Comments
 (0)