# cli-color-tty

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

Latest version **2.0.0** (published 2015-07-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install cli-color-tty
pnpm add cli-color-tty
yarn add cli-color-tty
bun add cli-color-tty
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2015-07-13 |
| First published | 2014-12-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alan Shaw |
| Maintainers | alanshaw |
| Keywords | tty, isTTY, ansi, color, console, terminal, cli, shell, log, logging, xterm |

## Links

- npm: https://www.npmjs.com/package/cli-color-tty
- Repository: https://github.com/alanshaw/cli-color-tty
- Issues: https://github.com/alanshaw/cli-color-tty/issues
- npm.io page: https://npm.io/package/cli-color-tty

## Dependencies (1)

- [cli-color](https://npm.io/package/cli-color.md) ^1.0.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2015-07-13
- 1.0.1 — 2015-01-03
- 1.0.0 — 2014-12-30

## README

# cli-color-tty [![Build Status](https://travis-ci.org/alanshaw/cli-color-tty.svg?branch=master)](https://travis-ci.org/alanshaw/cli-color-tty) [![Dependency Status](https://david-dm.org/alanshaw/cli-color-tty.svg)](https://david-dm.org/alanshaw/cli-color-tty) [![Coverage Status](https://img.shields.io/coveralls/alanshaw/cli-color-tty/master.svg?style=flat)](https://coveralls.io/r/alanshaw/cli-color-tty)

The [cli-color](https://github.com/medikoo/cli-color) module but TTY aware. It provides a cli-color compatible API that doesn't colorize your strings for non-TTY use.

## Example

```js
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

```js
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](https://github.com/medikoo/cli-color/blob/master/README.md).

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`

---
_Source: https://npm.io/package/cli-color-tty · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
