# console-prettify

> readme.md

Latest version **1.0.1** (published 2016-03-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install console-prettify
pnpm add console-prettify
yarn add console-prettify
bun add console-prettify
```

## 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 | 2016-03-29 |
| First published | 2015-11-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wheasy |
| Maintainers | wheasy |

## Links

- npm: https://www.npmjs.com/package/console-prettify
- Repository: https://github.com/wheasy/console-prettify
- Homepage: https://github.com/wheasy/console-prettify#readme
- Issues: https://github.com/wheasy/console-prettify/issues
- npm.io page: https://npm.io/package/console-prettify

## Recent versions

- 1.0.1 (latest) — 2016-03-29
- 0.0.2 — 2015-11-18

## README

扩展console，增加log、warn、error、info颜色输出。并新增 blue、cyan、green、magenta方法。

### 安装

    npm install console-prettify

### 使用

    require('console-prettify')();
    
    console.log('hello console');
    
### 参数
#### 前缀[prefix]

默认没有前缀，如要输出前缀，传参即可

    require('console-prettify')({
        prefix: true
    });
    
    console.log('log')
    console.info('info')
结果：

**log**: <span style="color:grey">log</span><br/>
**info**: <span style="color:green">info</span><br/>
**error**: <span style="color:red">info</span>

#### 自定义样式[theme]

如果默认样式满足你的需求，你可以通过`theme`参数自定义样式。

##### 样式
```
    require('console-prettify')({
        prefix: true,
        theme:{
            log: ['underline' ,'green', 'redBG']
        }
    });

    console.log('hello log')
```
输出：

<span style="font-weight:900">log:</span><span style="background-color:#bb040f;color:#00bd44;text-decoration: underline;">hello log</span>

##### Theme属性列表

名称  | 示例
------------- | -------------
bold    |**粗体**
underline  | <u>下划线_<u>
inverse |<span style="background:#000;color:#fff;">反色</span>
strikethrough   | <s>删除线</s>

有些属性貌似不支持，貌似我的Mac就不支持删除线

##### 文字颜色示例

属性  | 示例
------------- | -------------
white   |...
grey    |...
black   |...
blue    |...
cyan    |<span style="background-color:#00bbc5">&nbsp;&nbsp;&nbsp;</span>
green   |<span style="background-color:#00bd44">&nbsp;&nbsp;&nbsp;</span>
magenta |<span style="background-color:#ff39cb">&nbsp;&nbsp;&nbsp;</span>
red |<span style="background-color:#eb392b">&nbsp;&nbsp;&nbsp;</span>
yellow  |<span style="background-color:#aaae43">&nbsp;&nbsp;&nbsp;</span>

##### 背景颜色示例

属性  | 示例
------------- | -------------
whiteBG |...
greyBG  |...
blackBG |...
blueBG  |<span style="background-color:#3200ab">&nbsp;&nbsp;&nbsp;</span>
cyanBG  |<span style="background-color:#00a5b0">&nbsp;&nbsp;&nbsp;</span>
greenBG |<span style="background-color:#00a630">&nbsp;&nbsp;&nbsp;</span>
magentaBG   |<span style="background-color:#bb0510">&nbsp;&nbsp;&nbsp;</span>
redBG   |<span style="background-color:#bb040f">&nbsp;&nbsp;&nbsp;</span>
yellowBG    | <span style="background-color:#9a9924;">&nbsp;&nbsp;&nbsp;</span>

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