columnify icon indicating copy to clipboard operation
columnify copied to clipboard

is it possible to color the title?

Open elimau opened this issue 7 years ago • 1 comments

Related to topic of using colors in columnify using chalk as discussed in 26.

Is there a way to color the title? e.g.

var columnify = require('columnify');
var chalk = require('chalk');

var data = [{
    bar: 'normal color string', 
]};
data[chalk.red(foo)] = chalk.red('This is a red string');

console.log(columnify(data));

elimau avatar Feb 09 '18 02:02 elimau

const columnify = require('columnify');
const chalk = require('chalk');

const data = [
  {
     name: 'some name',
     value: 'some value'
  },{
     name: 'another name',
     value: 'another value'
  }
];
console.log(columnify(data,  {
    headingTransform: function(header){
        return chalk.red(header.charAt(0).toUpperCase + header.slice(1).toLowerCase());
    },
    dataTransform: function(data){
      return chalk.white(data);
   }
}));

xochilpili avatar Feb 27 '19 19:02 xochilpili