nodejs colors 模块设置控制台文本颜色

来源:互联网 发布:docker nginx jetty 编辑:程序博客网 时间:2024/06/15 19:48

转载自:http://www.bkjia.com/Javascript/720601.html

首先执行:

npm install colors

 

 

var colors = require('colors');colors.setTheme({    silly: 'rainbow',    input: 'grey',    verbose: 'cyan',    prompt: 'red',    info: 'green',    data: 'blue',    help: 'cyan',    warn: 'yellow',    debug: 'magenta',    error: 'red'});//bold//italic//underline//inverse//yellow//cyan//white//magenta//green//red//grey//blue//rainbow//zebra//randomconsole.log('hello'.green); // outputs green textconsole.log('i like cake and pies'.underline.red) // outputs red underlined textconsole.log('inverse the color'.inverse); // inverses the colorconsole.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)console.log('this is an error'.error);console.log('this is a warning'.warn);console.log('this is a debug'.debug);console.log('this is a help'.help);console.log('this is a silly'.silly);console.log('this is a input'.input);console.log('this is a prompt'.prompt);console.log('this is a data'.data);


 

0 0
原创粉丝点击