# debug-color2

> colorize console log, this module can work with require('debug')

Latest version **1.3.2** (published 2022-08-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install debug-color2
pnpm add debug-color2
yarn add debug-color2
bun add debug-color2
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.3.2 |
| Published | 2022-08-20 |
| First published | 2018-07-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 128 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | bluelovers |
| Maintainers | bluelovers |
| Keywords | 256, ansi, cli, color, colors, colour, command-line, console, debug, debugger, formatting, log, logging, rgb, shell, str, string, style, styles, terminal, text, tty, xterm, create-by-yarn-tool |

## Links

- npm: https://www.npmjs.com/package/debug-color2
- Repository: https://github.com/bluelovers/debug-color
- Homepage: https://github.com/bluelovers/debug-color#readme
- Issues: https://github.com/bluelovers/debug-color/issues
- npm.io page: https://npm.io/package/debug-color2

## Dependencies (6)

- [chalk](https://npm.io/package/chalk.md) <3 >=2
- [luxon](https://npm.io/package/luxon.md) ^3.0.1
- [tslib](https://npm.io/package/tslib.md) ^2
- [ts-type](https://npm.io/package/ts-type.md) ^2.1.10
- [env-bool](https://npm.io/package/env-bool.md) ^2.0.1
- [@types/luxon](https://npm.io/package/@types/luxon.md) *

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 1.3.2 (latest) — 2022-08-20
- 1.3.1 — 2022-07-31
- 1.2.7 — 2021-07-20
- 1.2.6 — 2021-07-20
- 1.2.5 — 2021-07-10
- 1.2.4 — 2021-07-09
- 1.2.3 — 2020-06-15
- 1.2.2 — 2020-06-11
- 1.2.1 — 2020-06-11
- 1.2.0 — 2020-06-11
- 1.1.7 — 2020-01-17
- 1.1.6 — 2019-06-13
- 1.1.5 — 2019-05-17
- 1.1.4 — 2019-05-17
- 1.1.3 — 2019-05-16
- … 11 more at https://npm.io/package/debug-color2/versions

## README

# debug-color2

    colorize console log, this module can work with require('debug')


1. same api with console
2. can work with [debug](https://www.npmjs.com/package/debug)

![demo.png](readme/demo.png)

## demo

[API](lib/node.d.ts)

```ts
export interface IOptions
{
	/**
	 * enable log display or not
	 */
	enabled?: boolean,

	/**
	 * show label string
	 */
	label?: boolean | string[],

	/**
	 * show time label
	 */
	time?: boolean,

	/**
	 * set default inspectOptions
	 */
	inspectOptions?: util.InspectOptions,

	/**
	 * set color style
	 */
	colors?: {
		debug?,
		error?,
		info?,
		log?,
		trace?,
		warn?,
		success?,
		ok?,
		[k: string]: string | Chalk | IChalkLike,
	},

	/**
	 * check is node.js console
	 */
	readonly stream?: boolean,
}
```

```ts
import ConsoleColorize, { Console } from 'debug-color2';

let options = {
    time: true,
    label: true,
};

let c1;
c1 = new Console();
c1 = new Console(console);
c1 = new Console(console, options);

c1 = ConsoleColorize.console
```

```ts
let c1 = new Console2();

c1.blue('blue');
c1.blue.log('blue.log');

c1.cyan.bgWhite('cyan.bgWhite');

c1.red.info('red.info');

c1.blue.debug('blue.debug');
c1.blue.error('blue.error');
c1.cyan.bgWhite.warn('cyan.bgWhite.warn');

c1.blue.success('blue.success');
c1.blue.ok('blue.ok');
//
c1.underline.info('underline.info');
c1.underline.bold.info('underline.bold.info');
c1.underline.bold.inverse.info('underline.bold.inverse.info');

c1.magenta.withOptions({
	time: true,
}).log('magenta.log');

c1.magenta.exception('magenta.exception');

let c2 = c1.magenta.withOptions({
	enabled: debug('test').enabled
});

console.log('DEBUG=test is', debug('test').enabled);

c2.log('this show when DEBUG=test or DEBUG=*');

console.log('----------------------');

c1.setOptions({
	label: true,
	time: true,
});

c1.log('log');
c1.assert(true, 'assert');

c1.debug('debug');
c1.info('info');

c1.exception('exception');
c1.error('error');
c1.warn('warn');

c1.success('success');
c1.ok('ok');
c1.fail('fail');
```

![demo.png](readme/demo.png)

![demo2.png](readme/demo2.png)

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