JSPM

cli-color-tty

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 375
  • Score
    100M100P100Q95127F
  • License ISC

cli-color that takes into account process.stdout.isTTY

Package Exports

  • cli-color-tty

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 (cli-color-tty) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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