safe-string.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. var colors = require('../safe');
  2. console.log(colors.yellow('First some yellow text'));
  3. console.log(colors.yellow.underline('Underline that text'));
  4. console.log(colors.red.bold('Make it bold and red'));
  5. console.log(colors.rainbow('Double Raindows All Day Long'));
  6. console.log(colors.trap('Drop the bass'));
  7. console.log(colors.rainbow(colors.trap('DROP THE RAINBOW BASS')));
  8. // styles not widely supported
  9. console.log(colors.bold.italic.underline.red('Chains are also cool.'));
  10. // styles not widely supported
  11. console.log(colors.green('So ') + colors.underline('are') + ' '
  12. + colors.inverse('inverse') + colors.yellow.bold(' styles! '));
  13. console.log(colors.zebra('Zebras are so fun!'));
  14. console.log('This is ' + colors.strikethrough('not') + ' fun.');
  15. console.log(colors.black.bgWhite('Background color attack!'));
  16. console.log(colors.random('Use random styles on everything!'));
  17. console.log(colors.america('America, Heck Yeah!'));
  18. console.log('Setting themes is useful');
  19. //
  20. // Custom themes
  21. //
  22. // console.log('Generic logging theme as JSON'.green.bold.underline);
  23. // Load theme with JSON literal
  24. colors.setTheme({
  25. silly: 'rainbow',
  26. input: 'grey',
  27. verbose: 'cyan',
  28. prompt: 'grey',
  29. info: 'green',
  30. data: 'grey',
  31. help: 'cyan',
  32. warn: 'yellow',
  33. debug: 'blue',
  34. error: 'red',
  35. });
  36. // outputs red text
  37. console.log(colors.error('this is an error'));
  38. // outputs yellow text
  39. console.log(colors.warn('this is a warning'));
  40. // outputs grey text
  41. console.log(colors.input('this is an input'));
  42. // console.log('Generic logging theme as file'.green.bold.underline);
  43. // Load a theme from file
  44. colors.setTheme(__dirname + '/../themes/generic-logging.js');
  45. // outputs red text
  46. console.log(colors.error('this is an error'));
  47. // outputs yellow text
  48. console.log(colors.warn('this is a warning'));
  49. // outputs grey text
  50. console.log(colors.input('this is an input'));
  51. // console.log(colors.zalgo("Don't summon him"))