eldargab / easy-table

Nice text table for Node.js
314 stars 31 forks source link

Added support for printing table cells with colors. #4

Closed timbowhite closed 12 years ago

timbowhite commented 12 years ago

Example usage:

var colors = require('colors'),
    Table = require('easy-table'),
    t = new Table;

for(var i=0; i<=10; i++){
    t.cell(
        'Foo',
        i,
        function(val){
            return val.toString().yellow;
        }
    );

    t.cell(
        'Bar',
        i,
        function(val){
            return val.toString().blue;
        }
    );

    t.cell(
        'Baz',
        i,
        function(val){
            return val.toString().red;
        }
    );
    t.newLine();
}

console.log(t.toString());
eldargab commented 12 years ago

I planned to store printers on per cell basis to support stuff like this.