print-message
Node.js module for printing out beautiful messages in console.
Installation
Install print-message
module:
npm install --save print-message
Getting Started
Require print-message
module and call a function:
const printMessage = require('print-message');
printMessage(['Hello, everyone']);
Options
You can set your own options for border.
const printMessage = require('print-message');
printMessage([
"You can set your own options for border",
"Options below is default options"
], {
border: true,
color: 'default',
borderColor: 'yellow',
borderSymbol: '─',
sideSymbol: '│',
leftTopSymbol: '┌',
leftBottomSymbol: '└',
rightTopSymbol: '┐',
rightBottomSymbol: '┘',
marginTop: 0,
marginBottom: 0,
paddingTop: 0,
paddingBottom: 0,
printFn: process.stdout.write.bind(process.stdout)
});
Examples
Print simple message
const printMessage = require('print-message');
printMessage([
"Hello",
"It's the huge world",
"But width can be calculated automatically"
]);
Print message with custom options
const printMessage = require('print-message');
printMessage(['You can set your own options for border'], {
border: true,
color: 'green',
borderColor: 'blue',
borderSymbol: '│',
sideSymbol: '│',
leftTopSymbol: '└',
leftBottomSymbol: '┌',
rightTopSymbol: '┘',
rightBottomSymbol: '┐',
marginTop: 3,
marginBottom: 3,
paddingTop: 2,
paddingBottom: 2,
printFn: function (message) {
process.stdout.write(message);
}
});
Print message without border
const printMessage = require('print-message');
printMessage([
"This message will be without border",
"But you still can set marginTop and marginBottom"
], {
border: false,
marginTop: 3,
marginBottom: 3
});
License
The MIT License (MIT)