Version 1
[yaffs-website] / node_modules / colors / examples / normal-usage.js
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
16 console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
17
18 console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse + ' styles! '.yellow.bold); // styles not widely supported
19 console.log("Zebras are so fun!".zebra);
20
21 //
22 // Remark: .strikethrough may not work with Mac OS Terminal App
23 //
24 console.log("This is " + "not".strikethrough + " fun.");
25
26 console.log('Background color attack!'.black.bgWhite)
27 console.log('Use random styles on everything!'.random)
28 console.log('America, Heck Yeah!'.america)
29
30
31 console.log('Setting themes is useful')
32
33 //
34 // Custom themes
35 //
36 console.log('Generic logging theme as JSON'.green.bold.underline);
37 // Load theme with JSON literal
38 colors.setTheme({
39   silly: 'rainbow',
40   input: 'grey',
41   verbose: 'cyan',
42   prompt: 'grey',
43   info: 'green',
44   data: 'grey',
45   help: 'cyan',
46   warn: 'yellow',
47   debug: 'blue',
48   error: 'red'
49 });
50
51 // outputs red text
52 console.log("this is an error".error);
53
54 // outputs yellow text
55 console.log("this is a warning".warn);
56
57 // outputs grey text
58 console.log("this is an input".input);
59
60 console.log('Generic logging theme as file'.green.bold.underline);
61
62 // Load a theme from file
63 colors.setTheme(__dirname + '/../themes/generic-logging.js');
64
65 // outputs red text
66 console.log("this is an error".error);
67
68 // outputs yellow text
69 console.log("this is a warning".warn);
70
71 // outputs grey text
72 console.log("this is an input".input);
73
74 //console.log("Don't summon".zalgo)