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