Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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`.
- Host: GitHub
- URL: https://github.com/sumory/beauty
- Owner: sumory
- Created: 2014-03-08T18:42:16.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-03-11T09:53:59.000Z (almost 11 years ago)
- Last Synced: 2024-08-09T15:47:29.334Z (5 months ago)
- Language: JavaScript
- Size: 372 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 themeconsole.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 themeconsole.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 stylizedconsole.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")