stylish-text
v1.1.3
Published
Make your text fancy, do progress bar, and many more (private project for my discord bot)
Downloads
29
Maintainers
Readme
live-xxx
An easy-to-use module to create progress bars and animate text !
Install
npm i --save stylish-text
Usage
//Example Usage
const bar = require(`stylish-text`)
//Change default parameters
bar.default.full = "="; //Default character when the bar is full
bar.default.empty = " "; //Default character when the bar isn't full
bar.default.text = "{bar} [{perc}]"; //use {bar} for the bar {perc} to display the percentage and {length} for the length of the bar (More options may be added)
//Example to animate chars
//Format: stylish([Array with all the frames], callback, duration (use 0 for infinite), interval) => calls the callback at the provided interval and returns the text (string)
bar.stylish([`|`, `/`, `–`, `\\`, `|`, `/`, `–`, `\\`], function (txt) {
console.clear()
console.log(`
┌───┐ ┌───┐
│ ${txt} │ Loading │ ${txt} │
└───┘ └───┘`)
}, 0, 100)
//Format: setInterval(interval between updates, how much is added each time, length of the bar, callback) => calls the callback at the provided interval and returns the bar (string)
bar.setInterval(150, 1, 20, function(bar) {
console.clear()
console.log(bar)
})
//Format: progress(Bar length, How much chars are full) => returns the bar (string)
bar.progress(20, 10)