diff --git a/Readme.md b/Readme.md index 6d353f14..5056e7ad 100644 --- a/Readme.md +++ b/Readme.md @@ -132,7 +132,7 @@ with keys corresponding to the options described in [CLI Arguments](#cliargs): ```js { - colorize: colorette.options.enabled, // --colorize + colorize: colorette.isColorSupported, // --colorize crlf: false, // --crlf errorLikeObjectKeys: ['err', 'error'], // --errorLikeObjectKeys errorProps: '', // --errorProps @@ -150,7 +150,7 @@ with keys corresponding to the options described in [CLI Arguments](#cliargs): ``` The `colorize` default follows -[`colorette.options.enabled`](https://github.com/jorgebucaran/colorette#optionsenabled). +[`colorette.isColorSupported`](https://github.com/jorgebucaran/colorette#iscolorsupported). `customPrettifiers` option provides the ability to add a custom prettify function for specific log properties. `customPrettifiers` is an object, where keys are diff --git a/index.js b/index.js index 51169814..f422a52c 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ 'use strict' -const { options: coloretteOptions } = require('colorette') +const { isColorSupported } = require('colorette') const pump = require('pump') const { Transform } = require('readable-stream') const abstractTransport = require('pino-abstract-transport') @@ -29,7 +29,7 @@ const jsonParser = input => { } const defaultOptions = { - colorize: coloretteOptions.enabled, + colorize: isColorSupported, crlf: false, errorLikeObjectKeys: ERROR_LIKE_KEYS, errorProps: '', diff --git a/lib/colors.js b/lib/colors.js index e8174e3a..53f55a55 100644 --- a/lib/colors.js +++ b/lib/colors.js @@ -15,17 +15,19 @@ const plain = { greyMessage: nocolor } -const colorette = require('colorette') +const { createColors } = require('colorette') +const { white, bgRed, red, yellow, green, blue, gray, cyan } = createColors({ useColor: true }) + const colored = { - default: colorette.white, - 60: colorette.bgRed, - 50: colorette.red, - 40: colorette.yellow, - 30: colorette.green, - 20: colorette.blue, - 10: colorette.gray, - message: colorette.cyan, - greyMessage: colorette.gray + default: white, + 60: bgRed, + 50: red, + 40: yellow, + 30: green, + 20: blue, + 10: gray, + message: cyan, + greyMessage: gray } function colorizeLevel (level, colorizer) { diff --git a/package.json b/package.json index 534be3cd..1f6e1a59 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ ], "dependencies": { "args": "^5.0.1", - "colorette": "^1.3.0", + "colorette": "^2.0.0", "dateformat": "^4.5.1", "fast-safe-stringify": "^2.0.7", "joycon": "^3.0.0", @@ -46,15 +46,15 @@ "strip-json-comments": "^3.1.1" }, "devDependencies": { - "@types/node": "^16.0.0", - "pino": "^6.0.0", + "@types/node": "^16.9.2", + "pino": "^6.13.2", "pre-commit": "^1.2.2", "rimraf": "^3.0.2", "snazzy": "^9.0.0", "standard": "^16.0.3", - "tap": "^15.0.0", + "tap": "^15.0.9", "tsd": "^0.17.0", - "typescript": "^4.2.4" + "typescript": "^4.4.3" }, "tsd": { "directory": "./test/types"