Package Exports
- colorize-template
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 (colorize-template) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Colorize Template
Tagged template literal for ANSI colors.
- No dependencies.
- Node.js v6+ & browsers support. Support both CJS and ESM projects.
- TypeScript type declarations included.
You need to provides an object which includes a variety of text coloring and formatting functions. You can use ready-made projects: Picocolors, Colorette, Kleur, Colors.js, Chalk
import { createColorize } from 'colorize-template'
import * as picocolors from 'picocolors'
import * as colorette from 'colorette'
let colorize = createColorize({
...picocolors,
success: picocolors.green,
error: colorette.red
})
console.log(
colorize`Is red {red color} text`,
colorize`Run {yellow.bgRed ${'yellow'} test}`,
colorize`Is red {error error and success {success green text}}`,
)
Blocks are delimited by an opening curly brace
{
, a style, some content, and a closing curly brace}
.