diff --git a/colors.js b/colors.js index c168564..4dc444f 100644 --- a/colors.js +++ b/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' : ['', ''], 'underline' : ['', ''], 'inverse' : ['', ''], + 'strikethrough' : ['', ''], //grayscale 'white' : ['', ''], 'grey' : ['', ''], @@ -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 diff --git a/example.html b/example.html index ab95649..7a2ae60 100644 --- a/example.html +++ b/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!')); diff --git a/example.js b/example.js index 1af7895..fb1fe9d 100644 --- a/example.js +++ b/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