Marak / colors.js

get colors in your node.js console
https://github.com/Marak/colors.js
Other
5.17k stars 446 forks source link

Custom Themes Buggy #226

Closed dishad closed 6 years ago

dishad commented 6 years ago

It seems that the current version of colors has made the use of custom themes buggy. I believe that this started occurring for versions > 1.2.1.

Example:

var colors = require('colors');
colors.setTheme({
  warn: 'yellow',
  error: 'red',
  success: 'green',
  info: 'blue',
  exit: 'bold'
});

console.log('Hello success!'.success);
console.log('Hello error!'.error);
console.log('Hello warn!'.warn);
console.log('Hello info!'.info);
console.log('Hello exit!'.exit);

console.log('Hello green!'.green);
console.log('Hello red!'.red);
console.log('Hello yellow!'.yellow);
console.log('Hello blue!'.blue);
console.log('Hello bold!'.bold);

will result in:

screen shot 2018-05-04 at 3 00 17 pm
Marak commented 6 years ago

@DABH ?

DABH commented 6 years ago

Investigating, will have an update shortly...

DABH commented 6 years ago

This has been fixed in v1.2.4 via https://github.com/Marak/colors.js/commit/855e342c9e26ab3d7232506cc42c240b7d800bf1 . The args there are String objects not string literals. Would be great to get to a place where no String objects appear in the codebase but we should be good for now at least. Thanks for bringing up this issue!