Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sumory/beauty

Beautiful console: colorful && stylized. Use it without doing anything to `console`.
https://github.com/sumory/beauty

Last synced: 3 months ago
JSON representation

Beautiful console: colorful && stylized. Use it without doing anything to `console`.

Awesome Lists containing this project

README

        

# beauty

Beautiful console and strings: colorful && stylized. Use it without doing anything to `console`.

## Install

```
npm install beauty
```

## Usage

Default:

```
var beauty = require('beauty');
beauty.beautifyConsole();//use default theme

console.log('log:', 'one', 'two');
console.info('info:','three');
console.warn('warn:', 'four');
console.error('error:', 'five');
```

Customize theme:

```
//only one color and several styles supported
var theme = {
'log': ['blue','underline'],
'info': ['cyan','inverse'],
'warn': ['yellow','italic'],
'error': ['red','bold','underline']
};
beauty.setTheme(theme);//set new theme

console.debug('debug:', 'zero');
console.log('log:', 'one', 'two');
console.info('info:','three');
console.warn('warn:', 'four');
console.error('error:', 'five');
```

Beautify string:

```
beauty.beautifyStr();//make strings colorful and stylized

console.debug('debug:', 'one'.red.bold,'two'.yellow.italic,'three'.green.underline);
console.log('log:', 'five'.italic);
console.info('info:','six');
console.warn('warn:', 'seven'.black.yellowBG);
console.error('error:', 'eight'.underline, 'nine'.black.blueBG);
```

Support formatted string:

```
console.log();
console.print('-> support formatted strings.');
var a =['%s %s%s. %d %s','Give me one','bit','coin',0,' Blockchain'.black.bold];
console.warn.apply(null,a)

console.log('%d%d %s every day. %s every block.', 500, 0, 'bitcoin'.red, '25'.green)
console.log('%s%s %s every day. %s every block.', '500', 0, 'bitcoin'.red, '25'.green)
```

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/sumory/beauty/trend.png)](https://bitdeli.com/free "Bitdeli Badge")