| 
									
										
										
										
											2010-06-11 07:25:35 -04:00
										 |  |  | var colors = require('./colors'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-14 17:40:30 -07:00
										 |  |  | //colors.mode = "browser";
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-14 18:02:32 -07:00
										 |  |  | var test = colors.red("hopefully colorless output"); | 
					
						
							| 
									
										
										
										
											2011-09-16 08:50:37 -07:00
										 |  |  | console.log('Rainbows are fun!'.rainbow); | 
					
						
							|  |  |  | console.log('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
 | 
					
						
							|  |  |  | console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
 | 
					
						
							|  |  |  | //console.log('zalgo time!'.zalgo);
 | 
					
						
							|  |  |  | console.log(test.stripColors); | 
					
						
							|  |  |  | console.log("a".grey + " b".black); | 
					
						
							| 
									
										
										
										
											2011-07-14 15:59:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 08:50:37 -07:00
										 |  |  | console.log("Zebras are so fun!".zebra); | 
					
						
							| 
									
										
										
										
											2011-07-14 18:08:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 08:50:37 -07:00
										 |  |  | console.log(colors.rainbow('Rainbows are fun!')); | 
					
						
							|  |  |  | console.log(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported
 | 
					
						
							|  |  |  | console.log(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported
 | 
					
						
							|  |  |  | //console.log(colors.zalgo('zalgo time!'));
 | 
					
						
							|  |  |  | console.log(colors.stripColors(test)); | 
					
						
							|  |  |  | console.log(colors.grey("a") + colors.black(" b")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | colors.addSequencer("america", function(letter, i, exploded) { | 
					
						
							| 
									
										
										
										
											2011-12-09 03:32:41 -08:00
										 |  |  |   if(letter === " ") return letter; | 
					
						
							|  |  |  |   switch(i%3) { | 
					
						
							|  |  |  |     case 0: return letter.red; | 
					
						
							|  |  |  |     case 1: return letter.white; | 
					
						
							|  |  |  |     case 2: return letter.blue; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-09-16 08:50:37 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-02 01:21:18 +02:00
										 |  |  | colors.addSequencer("random", (function() { | 
					
						
							| 
									
										
										
										
											2011-12-09 03:32:41 -08:00
										 |  |  |   var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; | 
					
						
							| 
									
										
										
										
											2011-10-02 01:21:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-09 03:32:41 -08:00
										 |  |  |   return function(letter, i, exploded) { | 
					
						
							|  |  |  |     return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]]; | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2011-10-02 01:21:18 +02:00
										 |  |  | })()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 08:50:37 -07:00
										 |  |  | console.log("AMERICA! F--K YEAH!".america); | 
					
						
							| 
									
										
										
										
											2011-10-02 01:21:18 +02:00
										 |  |  | console.log("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random); | 
					
						
							| 
									
										
										
										
											2011-12-09 03:32:41 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Custom themes
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | colors.setTheme({ | 
					
						
							|  |  |  |   silly: 'rainbow', | 
					
						
							|  |  |  |   input: 'grey', | 
					
						
							|  |  |  |   verbose: 'cyan', | 
					
						
							|  |  |  |   prompt: 'grey', | 
					
						
							|  |  |  |   info: 'green', | 
					
						
							|  |  |  |   data: 'grey', | 
					
						
							|  |  |  |   help: 'cyan', | 
					
						
							|  |  |  |   warn: 'yellow', | 
					
						
							|  |  |  |   debug: 'blue', | 
					
						
							|  |  |  |   error: 'red' | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // outputs red text
 | 
					
						
							|  |  |  | console.log("this is an error".error); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // outputs yellow text
 | 
					
						
							|  |  |  | console.log("this is a warning".warn); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 |