colorful console.log!
npm install --save-dev @kenworks/colorconsole
print colorful text in console.
- text: string, text content to print.
- color: string or int, color of text.
- bgcolor: string or int, color of background.
- effect: string, it can be 'bold', 'underline', 'blink', 'reverse', 'hide'.
return colorful text with ansi-escape sequences. which colorconsole.log
invokes and has the same parameters.
convenience to display color plate in console.
both can be these 8 colors (when it's string): 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'.
or, you can use integer which from 0 to 255.
save the following code to test.js
.
var colorconsole = require('@kenworks/colorconsole')
colorconsole.log('hello world!', 'red', null, 'bold')
colorconsole.log('hello world!', 'green', null, 'underline')
colorconsole.log('hello world!', 'blue', null, 'blink')
colorconsole.log('hello world!', 'magenta', null, 'hide')
colorconsole.log('hello world!', 'yellow', null, 'reverse')
colorconsole.log('hello world!', 'magenta', 'cyan')
colorconsole.log('hello world!', 228, null, 'blink')
colorconsole.log('hello world!', 9, 228, 'blink')
colorconsole.log('hello world!', null, null, 'reverse')
colorconsole.log('hello world!', 300, 600)
colorconsole.log('hello world!', 100)
colorconsole.log('hello world!', null, 100)
colorconsole.log('hello world!', 200, 300, 'blink', 'I\'m %s!', 'ken')
console.log(colorconsole.text('hello world!', 100, null, 'bold'), 'I\'m ken!')
run in terminal:
node test.js
you can see like this:
var colorconsole = require('@kenworks/colorconsole')
colorconsole.plate()
Copyright (c) 2019 kenblikylee