Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to color the title? #53

Open
elimau opened this issue Feb 9, 2018 · 1 comment
Open

is it possible to color the title? #53

elimau opened this issue Feb 9, 2018 · 1 comment

Comments

@elimau
Copy link

elimau commented Feb 9, 2018

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));
@xochilpili
Copy link

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);
   }
}));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants