~ tuck ~
┌─────────────────────────────┐
│ tuck your text into a box │
└─────────────────────────────┘
$ npm install --save tuck
var tuck = require("tuck");
console.log(tuck(["Hi There", "This is how we tuck text into a box"]));
┌─────────────────────────────────────┐
│ Hi There │
│ This is how we tuck text into a box │
└─────────────────────────────────────┘
var tuck = require("tuck");
console.log(tuck([
"",
"Hello",
"───",
"World",
""
], {
color: "yellow", // the color of the box (default: no color)
wall: "*", // the border of the box (default: the rectangle showed above)
padding: 3, // the padding of the box (default: 1)
center: true, // position of the box, will float left if false (default: false)
textCenter: true // position of the text, will float left if false (default: true)
}));
*************
* *
* Hello *
* ─── *
* World *
* * (the borders are yellow)
************* (trust me)
If you want to stylize the text in the box, use perfume syntax:
var tuck = require("tuck");
console.log(tuck([
"Here are some (blue text):blue",
"And here are some (red bold text):red:bold",
], {
color: "yellow",
textCenter: false
}));
┌─────────────────────────────────┐
│ Here are some blue text │
│ And here are some red bold text │
└─────────────────────────────────┘ (they are styled, trust me)
Install by running npm install --global tuck
(this is just for fun)
tuck <text> [option]
--color
set the color of the box (this should be the first flag)
--center
set the position of the box
set the color of the box
$ tuck 'Hello (World):red' --yellow --center