tiny-crayon
Terminal string styling
npm i tiny-crayon
Usage
const crayon = require('tiny-crayon')
console.log(
crayon.italic('hey'),
crayon.underline('hey'),
crayon.overline('hey'),
crayon.inverse('hey'),
crayon.strikethrough('hey')
)
console.log(
crayon.red(crayon.bold('hey')),
crayon.red('hey'),
crayon.redBright('hey'),
crayon.bgRed('hey'),
crayon.bgRedBright('hey')
)
console.log(
crayon.green(crayon.bold('hey')),
crayon.green('hey'),
crayon.greenBright('hey'),
crayon.bgGreen('hey'),
crayon.bgGreenBright('hey')
)
console.log(
crayon.blue(crayon.bold('hey')),
crayon.blue('hey'),
crayon.blueBright('hey'),
crayon.bgBlue('hey'),
crayon.bgBlueBright('hey')
)
console.log(Object.keys(crayon))
Custom stream
It's only used to check if colors are available on that stream, that's it.
By default it checks on process.stdout
which is enough.
const { Crayon } = require('tiny-crayon')
const crayon = new Crayon(process.stderr)
console.error(crayon.green('hey'))
License
MIT