# colorprint

> Print ansi-colored message to stdout/stderr.

Latest version **6.1.1** (published 2019-10-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install colorprint
pnpm add colorprint
yarn add colorprint
bun add colorprint
```

## 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 | 6.1.1 |
| Published | 2019-10-30 |
| First published | 2015-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 2 |
| Unpacked size | 60.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Taka Okunishi |
| Maintainers | okunishinishi |
| Keywords | ansi, color, console, print, log |

## Links

- npm: https://www.npmjs.com/package/colorprint
- Repository: https://github.com/okunishinishi/node-colorprint
- Homepage: https://github.com/okunishinishi/node-colorprint#readme
- Issues: https://github.com/okunishinishi/node-colorprint/issues
- npm.io page: https://npm.io/package/colorprint

## Dependencies (2)

- [cli-color](https://npm.io/package/cli-color.md) ^2.0.0
- [supports-color](https://npm.io/package/supports-color.md) ^7.1.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

- 6.1.1 (latest) — 2019-10-30
- 6.0.4 — 2019-07-26
- 6.0.3 — 2019-07-26
- 6.0.2 — 2019-07-26
- 6.0.1 — 2019-07-26
- 5.0.3 — 2019-02-28
- 5.0.2 — 2019-02-28
- 5.0.1 — 2019-02-28
- 5.0.0 — 2019-02-24
- 4.1.0 — 2016-09-11
- 4.0.11 — 2016-07-31
- 4.0.10 — 2016-07-31
- 4.0.9 — 2016-07-29
- 4.0.8 — 2016-07-18
- 4.0.7 — 2016-07-17
- … 25 more at https://npm.io/package/colorprint/versions

## README

colorprint
==========

<!---
This file is generated by ape-tmpl. Do not update manually.
--->

<!-- Badge Start -->
<a name="badges"></a>

[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]

[bd_repo_url]: https://github.com/okunishinishi/node-colorprint
[bd_travis_url]: http://travis-ci.org/okunishinishi/node-colorprint
[bd_travis_shield_url]: http://img.shields.io/travis/okunishinishi/node-colorprint.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/okunishinishi/node-colorprint
[bd_travis_com_shield_url]: https://api.travis-ci.com/okunishinishi/node-colorprint.svg?token=
[bd_license_url]: https://github.com/okunishinishi/node-colorprint/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/okunishinishi/node-colorprint
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/okunishinishi/node-colorprint.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/okunishinishi/node-colorprint.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/okunishinishi/node-colorprint
[bd_gemnasium_shield_url]: https://gemnasium.com/okunishinishi/node-colorprint.svg
[bd_npm_url]: http://www.npmjs.org/package/colorprint
[bd_npm_shield_url]: http://img.shields.io/npm/v/colorprint.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg

<!-- Badge End -->


<!-- Description Start -->
<a name="description"></a>

Print ansi-colored message to stdout/stderr.

<!-- Description End -->


<!-- Overview Start -->
<a name="overview"></a>

<img src="asset/images/screenshot.png"/>

<!-- Overview End -->


<!-- Sections Start -->
<a name="sections"></a>

<!-- Section from "doc/guides/01.Installation.md.hbs" Start -->

<a name="section-doc-guides-01-installation-md"></a>

Installation
-----

```bash
npm install colorprint --save
```


<!-- Section from "doc/guides/01.Installation.md.hbs" End -->

<!-- Section from "doc/guides/02-Usage.md.hbs" Start -->

<a name="section-doc-guides-02-usage-md"></a>

Usage
-------

```javascript
"use strict";

const colorpint = require('colorpint')

colorpint.notice('This is NOTICE') //Pipe to stdout with magenta color.
colorpint.info('This is INFO') //Pipe to stdout with green color.
colorpint.debug('This is DEBUG') //Pipe to stdout with  color.
colorpint.trace('This is TRACE') //Pipe to stdout with white color.
colorpint.warn('This is WARN') //Pipe to stdout with yellow color.
colorpint.error('This is ERROR') //Pipe to stderr with red color.
colorpint.fatal('This is FATAL') //Pipe to stderr with bgRed color.

```


<!-- Section from "doc/guides/02-Usage.md.hbs" End -->

<!-- Section from "doc/guides/03-CLI.md.hbs" Start -->

<a name="section-doc-guides-03-cli-md"></a>

Using via CIL
-------

### Install globally

```
$ npm install colorprint -g
```

### From Command Line

```bash
#!/bin/bash

colorpint notice "This is NOTICE from CLI" # Pipe to stdout with magenta color.
colorpint info "This is INFO from CLI" # Pipe to stdout with green color.
colorpint debug "This is DEBUG from CLI" # Pipe to stdout with  color.
colorpint trace "This is TRACE from CLI" # Pipe to stdout with white color.
colorpint warn "This is WARN from CLI" # Pipe to stdout with yellow color.
colorpint error "This is ERROR from CLI" # Pipe to stderr with red color.
colorpint fatal "This is FATAL from CLI" # Pipe to stderr with bgRed color.


```




<!-- Section from "doc/guides/03-CLI.md.hbs" End -->

<!-- Section from "doc/guides/04-Customizing.md.hbs" Start -->

<a name="section-doc-guides-04-customizing-md"></a>

Customizing
--------

### Customize the whole module.

```javascript
"use strict";

const colorprint = require('colorprint');
colorprint.PREFIX='Yeah!';
colorprint.INFO_COLOR='blue';
colorprint.info('This will be blue with prefix.');

```

### Create new context to customize.

```javascript
"use strict";

const Colorprint = require('colorprint/lib/colorprint');
let colorprint = new Colorprint({
    PREFIX: '[Foo]',
    INFO_COLOR: 'blue'
});
colorprint.info('This will be blue with prefix.');


```

colorprint is using [cli-color](https://github.com/medikoo/cli-color) for coloring and you can see [available colors here](https://github.com/medikoo/cli-color#colors).


<!-- Section from "doc/guides/04-Customizing.md.hbs" End -->


<!-- Sections Start -->


<!-- LICENSE Start -->
<a name="license"></a>

License
-------
This software is released under the [MIT License](https://github.com/okunishinishi/node-colorprint/blob/master/LICENSE).

<!-- LICENSE End -->

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