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