Package Exports
- clorox
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 (clorox) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Clorox
Clorox is a Node.js library for colorizing text using ANSI escape sequences.
- All-in-one — Not broken into a dozen modules that only work together.
- Eco-friendly — No modifications were made to the String.prototype in the making of this package.
- Non-toxic — Auto-detects color support without polluting your terminal with broken escape codes.
Installation
npm i clorox
Usage
const { Clorox: x } = require("clorox")
Write with color.
console.log(x.red("Hello World!"))
Chain expressions.
console.log(x.red.underline("Hola") + x.blue.bold("Mundo!"))
Compose a color expression using template literals.
console.log(
`${x.red("Hey!")}\n${x.blue.bold("Ho!")}\n${x.green.italic("Let's go!")}`
)
Nest expressions to reuse styles.
console.log(`${x.bold(x.blue("Bold/Blue") + "Bold")}`)
Styles
const { STYLES } = require("clorox")
console.log(`${STYLES.red.left}Red${STYLES.red.right}`)
Available Styles
Colors | Background Colors | Modifiers |
---|---|---|
black | bgBlack | dim |
red | bgRed | bold |
green | bgGreen | hidden |
yellow | bgYellow | italic |
blue | bgBlue | underline |
magenta | bgMagenta | inverse |
cyan | bgCyan | strikethrough |
white | bgWhite | reset |
gray |
License
Clorox is MIT licensed. See LICENSE.