stylish-text

1.1.3 • Public • Published

live-xxx

An easy-to-use module to create progress bars and animate text !

NPM Version

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)

Dependents (0)

Package Sidebar

Install

npm i stylish-text

Weekly Downloads

13

Version

1.1.3

License

ISC

Unpacked Size

10.7 kB

Total Files

4

Last publish

Collaborators

  • cstef_