node-color-readline

1.0.1 • Public • Published

node-color-readline

Node.js 'readline' alternative with support for coloured syntax highlighting and suggestions.

npm install --save node-color-readline

Usage:

 
var colorReadline = require('node-color-readline');
var chalk = require('chalk');
var repl = colorReadline.createInterface({
  input: process.stdin,
  output: process.stdout,
  colorize: function (str) {
    // Make all occurences of 'e' red.
    return str.replace(/e/g, function (match) {
      return chalk.red(match);
    });
  }
});
 
repl.on('line', function (cmd) {
  console.log('LINE:', cmd);
});
 
repl.prompt();

Screenshot

Package Sidebar

Install

npm i node-color-readline

Weekly Downloads

100

Version

1.0.1

License

MIT

Last publish

Collaborators

  • aantthony