gitmyhub

blessed

JavaScript ★ 12k updated 2y ago

A high-level terminal interface library for node.js.

A Node.js library for building rich interactive apps that run inside a terminal window, offering pre-built widgets like boxes, lists, forms, tables, and progress bars without dealing with terminal escape codes.

JavaScriptNode.jssetup: easycomplexity 3/5

blessed is a JavaScript library for Node.js that lets you build interactive applications that run inside a terminal window. Instead of dealing with the low-level details of terminal escape sequences, you get a set of pre-built widgets, similar to the kind of interface elements you would find in a desktop application, but displayed in text mode.

The library includes a wide range of widgets: boxes, text areas, scrollable lists, file browsers, forms with inputs and checkboxes, progress bars, tables, image viewers, and even a terminal widget that can run a terminal inside your terminal. Layout, positioning, and sizing can be specified in pixels or percentages, and styling supports colors, transparency, shadows, and hover effects. The API is designed to feel familiar to anyone who has built web interfaces, as it is modeled closely on the browser DOM.

Under the hood, blessed reimplements ncurses from scratch in JavaScript by parsing terminfo and termcap definitions. Rather than redrawing the entire screen on each update, it tracks which parts of the screen have changed and only sends the minimum number of escape sequences needed to update those regions. This makes rendering fast even in complex layouts.

The library supports event bubbling (events propagate up through parent widgets the way they do in a browser), artificial cursors, multiple screens, and server-side use (running a blessed app over a network connection in a shared terminal). It has been used as the foundation for other projects, including a text editor and a terminal dashboard library.

The full README is longer than what was shown.

Where it fits