Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[api] Added `strikethrough` style ( seems to be linux only ). Added `…

…strikethrough` examples. Closes #35
  • Loading branch information...
commit 67ab1a723269d4964ab45a468e00e13e76ae55b1 1 parent 435741e
@Marak authored
Showing with 9 additions and 1 deletion.
  1. +3 −1 colors.js
  2. +2 −0  example.html
  3. +4 −0 example.js
View
4 colors.js
@@ -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
View
2  example.html
@@ -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!'));
View
4 example.js
@@ -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

0 comments on commit 67ab1a7

Please sign in to comment.
Something went wrong with that request. Please try again.