source: trip-planner-front/node_modules/colors/examples/normal-usage.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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