Guest User

Untitled

a guest
Jan 16th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. cosnt chalk = require('chalk');
  2.  
  3. var colorIdx = 0;
  4. var rainbowLog = function (str) {
  5. var ary = [
  6. str => chalk.bold.red(str),
  7. str => chalk.bold.yellow(str),
  8. str => chalk.bold.yellowBright(str),
  9. str => chalk.bold.green(str),
  10. str => chalk.bold.cyan(str),
  11. str => chalk.bold.blue(str),
  12. str => chalk.bold.magenta(str),
  13. ];
  14.  
  15. if (!ary[colorIdx]) {
  16. colorIdx = 0;
  17. }
  18.  
  19. return ary[colorIdx++](str);
  20. };
Add Comment
Please, Sign In to add comment