1.0.0 • Published 5 years ago

bocks v1.0.0

Weekly downloads
10
License
-
Repository
github
Last release
5 years ago

bocks v0.0.1

Tiny version of cli-boxes (only the rounded box).

Currently, this library has zero configuration.™ Pass a string, get it wrapped in a rounded box (with 1 space of horizontal padding). As minimal as it gets. Zero dependencies!

Just 470 bytes with gzip! It could be smaller, but the code is cute and ANSI support adds a few pounds.

const bocks = require('bocks')

console.log(bocks('hello world'))
// ╭─────────────╮
// │ hello world │
// ╰─────────────╯

NOTE: Multi-line boxes are not yet supported! (PRs accepted)

ANSI coloring

Painting the box with your favorite ANSI color library is easy! Try it with chalk.

const chalk = require('chalk')

let str = bocks(chalk.blue('hello world'))
str = str.replace(bocks.RE, chalk.red('$1'))

// See a beautiful red box with blue text! 😍
console.log(str)