https://github.com/plotdb/colors
https://github.com/plotdb/colors
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/plotdb/colors
- Owner: plotdb
- Created: 2022-01-11T06:21:28.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-03T03:41:02.000Z (over 3 years ago)
- Last Synced: 2025-06-04T14:17:12.764Z (10 months ago)
- Language: LiveScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# @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
| fg | bright fg | bg | bright bg | styles |
|---------|---------------|-----------|-----------------|---------------|
| black | brightRed | bgBlack | bgBrightRed | reset |
| red | brightGreen | bgRed | bgBrightGreen | bold |
| green | brightYellow | bgGreen | bgBrightYellow | dim |
| yellow | brightBlue | bgYellow | bgBrightBlue | italic |
| blue | brightMagenta | bgBlue | bgBrightMagenta | underline |
| magenta | brightCyan | bgMagenta | bgBrightCyan | inverse |
| cyan | brightWhite | bgCyan | bgBrightWhite | hidden |
| white | | bgWhite | | strikethrough |
| gray | | bgGray | | |
| grey | | bgGrey | | |
## Note
`@plotdb/colors` extends String.prototype directly which may not be a good approach.
## Reference
- https://github.com/marak/colors.js/
## License
MIT