@makerx/color-console
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@makerx/color-console

Wraps chalk and console to provide a console interface which automatically formats tagged template literals with base text and interpolated arguments in different colours.

Installation

npm i @makerx/color-console --save

Example

import { colorConsole, createColorFormatter } from './index'
import chalk from 'chalk'

// Use the default colorConsole object
colorConsole.log`Example of log with args ${1}, ${2}, ${'three'}`
colorConsole.info`Example of info with args ${1}, ${2}, ${'three'}`
colorConsole.warn`Example of warn with args ${1}, ${2}, ${'three'}`
colorConsole.error`Example of error with args ${1}, ${2}, ${'three'}`
colorConsole.success`Example of success with args ${1}, ${2}, ${'three'}`

// Create your own custom formatter
const customLogger = createColorFormatter(chalk.magenta, chalk.greenBright, 'log', console)

customLogger`Example of custom with args ${1}, ${2}, ${'three'}`

will result in

Example output

Readme

Keywords

Package Sidebar

Install

npm i @makerx/color-console

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

8.55 kB

Total Files

8

Last publish

Collaborators

  • makerx-engineering
  • patrick.dinh
  • plebsori
  • makerxuser