Repository | http://github.com/Marak/colors.js.git (git) |
---|---|
Homepage | https://github.com/Marak/colors.js |
Bugs | https://github.com/Marak/colors.js/issues |
安装
npm install colors
bold italic underline inverse yellow cyan white magenta green red grey blue rainbow zebra random
var colors = require(‘./colors‘); console.log(‘hello‘.green); // outputs green text console.log(‘i like cake and pies‘.underline.red) // outputs red underlined text console.log(‘inverse the color‘.inverse); // inverses the color console.log(‘OMG Rainbows!‘.rainbow); // rainbow (ignores spaces)
var colors = require(‘colors‘); colors.setTheme({ silly: ‘rainbow‘, input: ‘grey‘, verbose: ‘cyan‘, prompt: ‘grey‘, info: ‘green‘, data: ‘grey‘, help: ‘cyan‘, warn: ‘yellow‘, debug: ‘blue‘, error: ‘red‘ }); // outputs red text console.log("this is an error".error); // outputs yellow text console.log("this is a warning".warn);
原文:http://blog.csdn.net/xiaocie3456/article/details/18350391