prettyjson
prettyjson copied to clipboard
Switch `colors` to `chalk` - Fixes #57
This PR migrates prettyjson from colors to chalk - Related: #57 #54
This breaks support for the following "colors":
- rainbow
- zebra
- america
- trap
- random
- zalgo
These were present in colors.js and are not present in chalk
One of these "colors" (rainbow) is referenced in a unit test. Options: A. Delete the unit test B. Implement this color (and other alternative colors?) on top of chalk.js
Additionally, in chalk 5.x, they have gone ESM-only, so I pinned us to chalk @ 4.x -- chalk's 5.0 release links to Pure ESM
Features
- Hex Color Support!
"#FFFFFF" -
options.unknownColorHandlerby default warns users if a color isn't supported. This warning can be disabled via"ignore", or the user can provide a custom function to render a given input into the expected "color" - Allow overriding of true/false color via
options.trueColor,options.falseColor - Allow overriding of null/undefined color via
options.nullUndefinedColor
Remaining Tasks
- [ ] Resolve the broken test / alternative-colors decision
- [ ] Acknowledge
chalk < 5constraint, or decide how to proceed