cli-color-tty

2.0.0 • Public • Published

cli-color-tty Build Status Dependency Status Coverage Status

The cli-color module but TTY aware. It provides a cli-color compatible API that doesn't colorize your strings for non-TTY use.

Example

var clc = require('cli-color-tty')(true)
// clc is = require('cli-color')
 
console.log(clc.red('RED')) // -> '\x1b[31mRED\x1b[39m'
 
clc = require('cli-color-tty')(false)
// clc is a cli-color compatible API that doesn't colorize
 
console.log(clc.red('RED')) // -> 'RED'

Usage

var clc = require('cli-color-tty')(/* true/false/default: process.stdout.isTTY */)

After calling the factory function, use it as per the cli-color docs.

Pass true to the factory function to get back the cli-color module.
Pass false to get back a cli-color compatible object that doesn't colorize your strings.
Defaults to process.stdout.isTTY

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    581
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    581
  • 1.0.1
    5
  • 1.0.0
    0

Package Sidebar

Install

npm i cli-color-tty

Weekly Downloads

586

Version

2.0.0

License

ISC

Last publish

Collaborators

  • alanshaw