# print-colors

> Print colors to the console with nice and easy to use syntax

Latest version **1.0.1** (published 2017-08-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install print-colors
pnpm add print-colors
yarn add print-colors
bun add print-colors
```

## 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 | 1.0.1 |
| Published | 2017-08-23 |
| First published | 2017-08-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ori Shalom |
| Maintainers | ori-s |
| Keywords | colors, print, cmd, bash, cli, command, line, console, log, color, rainbow |

## Links

- npm: https://www.npmjs.com/package/print-colors
- Repository: https://github.com/ori-shalom/print-colors
- Homepage: https://github.com/ori-shalom/print-colors#readme
- Issues: https://github.com/ori-shalom/print-colors/issues
- npm.io page: https://npm.io/package/print-colors

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-08-23
- 1.0.0 — 2017-08-23

## README

# print-colors
**_print-colors_** is a very lightweight library for printing colors to the console using a nice and easy to use syntax.

Import the module to your project:
```javascript
const c = require('print-colors');
```

To print to your console some "How to use" examples you can use the `example()`, `docs()` or `help()` functions available with the library to print some example to the console.
```javascript
const c = require('print-colors');

c.example();
```

In order to affect the color of the text printed to the console with the built in `console.log()` function, you need to follow the following template:
```
console.log(c.(background or foreground).(light or dark).(color) + 'Some Text' + c.end);
```

## Examples:
```javascript
const c = require('print-colors');

console.log(c.foreground.light.red + 'This text will be printed in light red color' + c.end);

console.log(c.foreground.dark.green + 'This text will be printed in dark green color' + c.end);

console.log(c.background.dark.blue + 'This text will be printed with dark blue background color' + c.end);
```

You can also have combinations of background and foreground colors like so:
```javascript
console.log(c.background.light.yellow + c.foreground.dark.blue + 'This text will be blue with yellow background color' + c.end);
```

### You can use this set of shortcuts for having a better syntax:
- bg = background
- fg = foreground
- l = light
- d = dark
- e = end

So in practice, the above examples can be shortted as follow:
```javascript
console.log(c.fg.l.red + 'This text will be printed in light red color' + c.e);

console.log(c.fg.d.green + 'This text will be printed in dark green color' + c.e);

console.log(c.bg.d.blue + 'This text will be printed with dark blue background color' + c.e);

console.log(c.bg.l.yellow + c.fg.d.blue + 'This text will be blue with yellow background color' + c.e);
```

### Supported colors:
- gray
- red
- green
- yellow
- blue
- pink
- cyan
- white

### Note
The following library was tested with Windows CMD.exe.
Colors might look different from one console to another since the console colors are many time can be configured by the user...

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