Smart and seamless colored console output across all platforms.
No configuration necessary.
[ And no built-ins were harmed in the making of this movie! ]
I wanted to enhance the console output of a project I was working on. I needed color, certainly... but I also needed a smarter way to display more complex, structured information in the console e.g. table data or JS objects.
I looked at what was available on NPM and GitHub and searched for a single solution. After trying out and experimenting with about twenty different packages - and finding all of them missing something essential. I needed something:-
- More capable than chalk.js, color.js, colour.js, col.js, etc etc...
..."Hey, where's my color orange?"
- More standard than things like prettyjson
..."Look, I just wanted standard JSON... not this YAMLized 'something'!!!"
- Lighter than terminal-kit.
..."I'm asking for better console output... not a rocket-ship with six different kitchen sinks and a dog kennel!"
- And to work everywhere just the same. At least in both the browser and with Node.
"Ok, NPM search results: 0 ...help!!!"
So, finding nothing suitable... I did what any good coder would do... and wrote the solution myself!
I share it with you now... and I've called it Pageant! (After the ye old medieval-ly colorful procession thingies...)
Ok then, go on... amaze me!
- A safe drop-in replacement for the built-in console - supports all standard functionality.
- Enriches, formats, syntax-hightlights the display of all data - for greater clarity and readability.
- Supports all JS values, objects and code - as well as JSON objects and arrays.
- Uses the full color palette available for 16, 256 and TrueColor capable consoles.
- Works well out-the-box - but can easily be customised by code or by config file.
- Simple to use.
npm install pageant
Pageant is safe to use with existing code... just import and assign Pageant at the top of your script:-
const Pageant = ;const console = ;
Then, just as you would normally:-
or if you want enriched data you can:-
let valueA = 1;let valueB = "1";console;console;console;let arrayObjects =id: 10 first: "John" second: "Smith" age: 24 active: trueid: 11 first: "John" second: "Harlow" age: 41 active: trueid: 12 first: "Sally" second: "May" age: 28 active: false;console;
And you will also find that the normal 'dumb' alias of console.debug()... isn't so dumb anymore!
consoleconfigdebug = true;console;consoleconfigdebug = false;console;
TODO July 2017 - Currently Pageant Node functionality is being completed. Browser support is still only partial at present.
Documentation about usage and configuration can be found in Wiki:Configuration page.
Pageant was written by Kyle Alexis Sargeant and is shared under the LGPL-3.0 license.
Thus, you can use it freely in anything - both open-source or commercial - without any need to disclose your own code.