0.0.3 • Published 2 years ago

@plotdb/colors v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@plotdb/colors

get colors in your node.js console.

Installation

npm install --save @plotdb/colors

Usage

require("@plotdb/colors")
console.log("some colored text".red);
console.log("some colored text with red background".bgRed.yellow);
colors.disable(); /* colored outputs are disabled after this */
console.log("some text without style / color".bgRed.yellow);
colors.enable(); /* colored outputs are disabled after this */
console.log("color is back".bgRed.yellow);
colors.red("some red text");
colors.green.underline("some red text"); /* recursively */
colors.green.underline.red("some red text"); /* will be red. high priority for deeper styles */

Colors and Styles

fgbright fgbgbright bgstyles
blackbrightRedbgBlackbgBrightRedreset
redbrightGreenbgRedbgBrightGreenbold
greenbrightYellowbgGreenbgBrightYellowdim
yellowbrightBluebgYellowbgBrightBlueitalic
bluebrightMagentabgBluebgBrightMagentaunderline
magentabrightCyanbgMagentabgBrightCyaninverse
cyanbrightWhitebgCyanbgBrightWhitehidden
whitebgWhitestrikethrough
graybgGray
greybgGrey

Note

@plotdb/colors extends String.prototype directly which may not be a good approach.

Reference

License

MIT