0.0.3 • Published 2 years ago
color-properties v0.0.3
color-properties
Extends the String prototype with color and text decoration attributes, allowing for easy styling of console output using ANSI escape codes.
Installation
npm install color-propertiesUsage
First, import the colorize function:
const { colorize } = require('color-properties');Next, run the colorize function to extend the String prototype with color and decoration properties:
colorize();Alternatively you can also extend the string directly:
require('color-properties/colorize');Now, you can use the color and decoration properties directly on string instances. Here's an example:
console.log('Hello World!'.green.bright); // prints "Hello World!" in green and bold styleStyles
The following styles are avainable:
resetbrightdimitalicunderlineinversehiddenstrikethroughblackredgreenyellowbluemagentacyanwhitegraybgBlackbgRedbgGreenbgYellowbgBluebgMagentabgCyanbgWhitebgGray
Refer to the example for combining multiple properties.
License
MIT