mirror of
				https://github.com/flynx/colors.js.git
				synced 2025-10-31 20:10:09 +00:00 
			
		
		
		
	[api] Added strikethrough style ( seems to be linux only ). Added strikethrough examples. Closes #35
				
					
				
			This commit is contained in:
		
							parent
							
								
									435741eea0
								
							
						
					
					
						commit
						67ab1a7232
					
				| @ -66,6 +66,7 @@ function stylize(str, style) { | ||||
|       'italic'    : ['\x1B[3m',  '\x1B[23m'], | ||||
|       'underline' : ['\x1B[4m',  '\x1B[24m'], | ||||
|       'inverse'   : ['\x1B[7m',  '\x1B[27m'], | ||||
|       'strikethrough' : ['\x1B[9m',  '\x1B[29m'], | ||||
|       //grayscale
 | ||||
|       'white'     : ['\x1B[37m', '\x1B[39m'], | ||||
|       'grey'      : ['\x1B[90m', '\x1B[39m'], | ||||
| @ -85,6 +86,7 @@ function stylize(str, style) { | ||||
|       'italic'    : ['<i>',  '</i>'], | ||||
|       'underline' : ['<u>',  '</u>'], | ||||
|       'inverse'   : ['<span style="background-color:black;color:white;">',  '</span>'], | ||||
|       'strikethrough' : ['<del>',  '</del>'], | ||||
|       //grayscale
 | ||||
|       'white'     : ['<span style="color:white;">',   '</span>'], | ||||
|       'grey'      : ['<span style="color:grey;">',    '</span>'], | ||||
| @ -133,7 +135,7 @@ function applyTheme(theme) { | ||||
| //
 | ||||
| // Iterate through all default styles and colors
 | ||||
| //
 | ||||
| var x = ['bold', 'underline', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; | ||||
| var x = ['bold', 'underline', 'strikethrough', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; | ||||
| x.forEach(function (style) { | ||||
| 
 | ||||
|   // __defineGetter__ at the least works in more browsers
 | ||||
|  | ||||
| @ -20,6 +20,8 @@ | ||||
|     document.write("Zebras are so fun!".zebra); | ||||
| 
 | ||||
|     document.write(colors.rainbow('Rainbows are fun!')); | ||||
|     document.write("This is " + "not".strikethrough + " fun."); | ||||
| 
 | ||||
|     document.write(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported | ||||
|     document.write(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported | ||||
|     //document.write(colors.zalgo('zalgo time!')); | ||||
|  | ||||
| @ -12,6 +12,10 @@ console.log("a".grey + " b".black); | ||||
| 
 | ||||
| console.log("Zebras are so fun!".zebra); | ||||
| 
 | ||||
| //
 | ||||
| // Remark: .strikethrough may not work with Mac OS Terminal App
 | ||||
| //
 | ||||
| console.log("This is " + "not".strikethrough + " fun."); | ||||
| 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
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user