A drop-in replacement for for Blessed. A high-level terminal interface library for node.js.
Go to file
Christopher Jeffrey e8a20fdb77 readme 2013-01-27 12:33:32 -06:00
lib readme 2013-01-27 11:27:34 -06:00
LICENSE readme. license. 2013-01-27 10:06:58 -06:00
README.md readme 2013-01-27 12:33:32 -06:00
index.js initial 2013-01-27 04:30:52 -06:00
package.json initial 2013-01-27 04:30:52 -06:00

README.md

blessed

A curses-like library for node.js.

As of right now, it does not read all terminfo. It was designed for one terminal's terminfo: xterm.

I want this library to eventually become a high-level library for terminal widgets.

Example Usage

var Program = require('blessed')
  , program = new Program;

program.on('key', function(ch, key) {
  if (key.ctrl && key.name === 'c') {
    console.log('This would have been SIGINT!');
  }
});

program.setMouse({ normalMouse: true });

program.on('mouse', function(data) {
  console.log('Mouse event received:');
  console.log(data.button, data.x, data.y);
});

program.alternateBuffer();

program.clear();

program.bg('white');
program.write('Hello world', 'blue fg');
program.setx(1);
program.down(5);
program.write('Hi again!');
program.bg('!white');
program.feed();

program.getCursor(function(err, data) {
  if (!err) {
    console.log('Cursor is at: %s, %s.', data.x, data.y);
  }

  program.charset('SCLD');
  program.write('abcdefghijklmnopqrstuvwxyz0123456789');
  program.charset('US');
  program.setx(0);

  setTimeout(function() {
    program.eraseInLine('right');
    setTimeout(function() {
      program.clear();
      program.normalBuffer();
      program.setMouse({ normalMouse: false });
    }, 2000);
  }, 2000);
});

License

Copyright (c) 2013, Christopher Jeffrey. (MIT License)

See LICENSE for more info.