Skip to content

Commit

Permalink
util: use blue on non-windows systems for number/bigint
Browse files Browse the repository at this point in the history
PR-URL: nodejs#18925
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
devsnek committed Feb 25, 2018
1 parent da886d9 commit 1708af3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,11 @@ inspect.colors = Object.assign(Object.create(null), {
});

// Don't use 'blue' not visible on cmd.exe
const windows = process.platform === 'win32';
inspect.styles = Object.assign(Object.create(null), {
'special': 'cyan',
'number': 'yellow',
'bigint': 'yellow',
'number': windows ? 'yellow' : 'blue',
'bigint': windows ? 'yellow' : 'blue',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-stream-buffer-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ assert.deepStrictEqual(list, new BufferList());

const tmp = util.inspect.defaultOptions.colors;
util.inspect.defaultOptions = { colors: true };
const color = util.inspect.colors[util.inspect.styles.number];
assert.strictEqual(
util.inspect(list),
'BufferList { length: \u001b[33m0\u001b[39m }');
`BufferList { length: \u001b[${color[0]}m0\u001b[${color[1]}m }`);
util.inspect.defaultOptions = { colors: tmp };

0 comments on commit 1708af3

Please sign in to comment.