source: trip-planner-front/node_modules/colors/examples/safe-string.js@ e29cc2e

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

initial commit

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