Package Exports
- console-styles
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (console-styles) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
About
console styles is a simple package for logging information to the console that is coloured/styled in anyway you like. Side note, not all styles and colours will work depending on what system you are running so be weary. I made this because I was messing around with JavaScript Proxy objects and I liked the idea of incorporating console.log
into it rather than wrapping it around a styled string. An alternative to just style strings without logging them is provided as well.
Comes with some TypeScript definitions!
Install
npm install --save console-styles
Example
const styler = require("console-styles");
// log underlined red text to the console
styler.red.underline.log("hola amigos");
// log black text with cyan background to the console
styler.black.bgCyan.log("wow");
// More freedom, allows for multiple styles in one line
console.log(styler.black.bgCyan.col("this is great Kappa"));
Styles
All styles can be chained, on most systems styles like blink and hidden won't work.
const styler = require("console-styles");
styler.reset.log("Removes styles");
styler.bright.log("Makes text bold/bright");
styler.bold.log("Makes text bold/bright");
styler.dim.log("Darkens text");
styler.underline.log("Underline text");
styler.blink.log("Blinking text");
styler.reverse.log("Inverse style");
styler.hidden.log("Hides text");
styler.black.log("Black coloured text");
styler.red.log("Red coloured text");
styler.green.log("Green coloured text");
styler.yellow.log("Yellow coloured text");
styler.blue.log("Blue coloured text");
styler.magenta.log("Magenta coloured text");
styler.cyan.log("Cyan coloured text");
styler.white.log("White coloured text");
styler.bgBlack.log("Black background text");
styler.bgRed.log("Red background text");
styler.bgGreen.log("Green background text");
styler.bgYellow.log("Yellow background text");
styler.bgBlue.log("Blue background text");
styler.bgMagenta.log("Magenta background text");
styler.bgCyan.log("Cyan background text");
styler.bgWhite.log("White background text");