util: use blue on non-windows systems for number/bigint
PR-URL: https://github.com/nodejs/node/pull/18925 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
parent
da886d9a4c
commit
1708af369b
@ -339,10 +339,11 @@ inspect.colors = Object.assign(Object.create(null), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Don't use 'blue' not visible on cmd.exe
|
// Don't use 'blue' not visible on cmd.exe
|
||||||
|
const windows = process.platform === 'win32';
|
||||||
inspect.styles = Object.assign(Object.create(null), {
|
inspect.styles = Object.assign(Object.create(null), {
|
||||||
'special': 'cyan',
|
'special': 'cyan',
|
||||||
'number': 'yellow',
|
'number': windows ? 'yellow' : 'blue',
|
||||||
'bigint': 'yellow',
|
'bigint': windows ? 'yellow' : 'blue',
|
||||||
'boolean': 'yellow',
|
'boolean': 'yellow',
|
||||||
'undefined': 'grey',
|
'undefined': 'grey',
|
||||||
'null': 'bold',
|
'null': 'bold',
|
||||||
|
@ -34,7 +34,8 @@ assert.deepStrictEqual(list, new BufferList());
|
|||||||
|
|
||||||
const tmp = util.inspect.defaultOptions.colors;
|
const tmp = util.inspect.defaultOptions.colors;
|
||||||
util.inspect.defaultOptions = { colors: true };
|
util.inspect.defaultOptions = { colors: true };
|
||||||
|
const color = util.inspect.colors[util.inspect.styles.number];
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
util.inspect(list),
|
util.inspect(list),
|
||||||
'BufferList { length: \u001b[33m0\u001b[39m }');
|
`BufferList { length: \u001b[${color[0]}m0\u001b[${color[1]}m }`);
|
||||||
util.inspect.defaultOptions = { colors: tmp };
|
util.inspect.defaultOptions = { colors: tmp };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user