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.
- Eco-friendly: Clorox does not extend the String.prototype.
- Concentrated: Clorox has no dependencies, nor is it broken into a dozen modules that only work together.
- Non-toxic: Clorox auto-detects terminal color support and doesn't pollute your terminal with unrecognized escape codes.
Installation
npm i clorox
Usage
const c = require("clorox")
Examples
Compose a color expression.
console.log(`${c.red.bold("What's").newLine.inverse("up?")}`)
Concatenate expressions.
console.log(c.red.bold("What's") + "\n" + c.red.inverse("up?"))
Nest expressions to reuse styles.
console.log(`${c.bold(c.red("Bold & Red"))}`)
Create your own styles.
const Styles = {
em(s) {
return c.bgBlack.yellow(s)
}
}
console.log(`${c(Styles.em("Known trope")).bold(" or meme")}`)
Styles
Colors | Background Colors | Modifiers | Other |
---|---|---|---|
black | bgBlack | dim | newLine |
red | bgRed | bold | tab |
green | bgGreen | hidden | reset |
yellow | bgYellow | italic | |
blue | bgBlue | underline | |
magenta | bgMagenta | inverse | |
cyan | bgCyan | strikethrough | |
white | bgWhite | ||
gray |
License
Clorox is MIT licensed. See LICENSE.