tui623
v1.0.0
Published
A lightweight terminal user interface library for Node.js that provides screen buffering, drawing operations, and display management for console-based applications.
Downloads
89
Maintainers
Readme
tui623
A lightweight terminal user interface library for Node.js that provides screen buffering, drawing operations, and display management for console-based applications.
Installation
npm install tui623Usage
const { Compositor } = require("tui623");
const compositor = new Compositor();
compositor.init();
// Draw some text
compositor.draw(0, 0, 20, 1, "Hello, World!");
// Render to terminal
compositor.display();API
Compositor
Constructor
Creates a new Compositor instance.
init()
Initializes the compositor with current terminal dimensions.
display()
Renders the current screen buffer to the terminal.
draw(x, y, width, height, content)
Draws text content onto the screen buffer at the specified position.
x(number): The x position (default: 0)y(number): The y position (default: 0)width(number): The width of the drawing area (default: 1)height(number): The height of the drawing area (default: 1)content(string): The text content to draw (default: " ")
fill(x, y, width, height, char)
Fills a rectangular area with a specified character.
x(number): The x position (default: 0)y(number): The y position (default: 0)width(number): The width of the area (default: 1)height(number): The height of the area (default: 1)char(string): The character to fill with (default: " ")
drawRow(x, y, width, char)
Draws a horizontal row line.
drawDivider(x, y, height, char)
Draws a vertical divider line.
Other methods
toString(screen): Converts screen buffer to stringgenRow(width, char): Generates a row arraygenFill(width, height): Generates a screen buffer
UseCompositor
A utility class that sets up a global compositor instance.
Example
See test.js for a bouncing text animation example.
License
ISC
