neat-frame
Generate simple framed text
const neatFrame = ; console;
┌──────────────────────────────────────────────────────────────────────────┐
│ │
│ neat-frame │
│ Generate simple framed text from a string │
│ │
└──────────────────────────────────────────────────────────────────────────┘
- No config, 1 simple beautiful output
- Single-line border
- 1 padding between text and borders
- 2 horizontal spaces on both side of the box
- Left-aligned text
- Automatic box width adjustment for the current terminal width
- Even support for a non-TTY environment where
process.stdout.columns
is unavailable
- Even support for a non-TTY environment where
- Automatic line breaking for long text
Installation
npm install neat-frame
API
const neatFrame = ;
neatFrame(input)
input: string
Return: string
// When the terminal width is 30 ;/* => ┌────────────────────────┐ │ │ │ abcdefghijklmnopqrstuv │ │ wxyz │ │ │ └────────────────────────┘*/ // When the terminal width is 20 ;/* => ┌──────────────┐ │ │ │ abcdefghijkl │ │ mnopqrstuvwx │ │ yz │ │ │ └──────────────┘*/
License
ISC License © 2017 Shinnosuke Watanabe