added more colors. need to modify library so that we dont have to list all colors and styles twice

This commit is contained in:
Marak Squires 2010-06-11 04:07:05 -04:00
parent 34845fc1f4
commit 2b2840fed1

View File

@ -1,4 +1,4 @@
['bold', 'grey', 'yellow', 'red', 'green', 'white', 'cyan'].forEach(function (style) { ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'].forEach(function (style) {
Object.defineProperty(String.prototype, style, { Object.defineProperty(String.prototype, style, {
get: function () { get: function () {
return stylize(this, style); return stylize(this, style);
@ -17,6 +17,9 @@ function stylize(str, style) {
'green' : [32, 39], 'green' : [32, 39],
'red' : [31, 39], 'red' : [31, 39],
'grey' : [90, 39], 'grey' : [90, 39],
'blue' : [34, 39],
'magenta' : [35, 39],
'inverse' : [7, 27]
}; };
return '\033[' + styles[style][0] + 'm' + str + return '\033[' + styles[style][0] + 'm' + str +
'\033[' + styles[style][1] + 'm'; '\033[' + styles[style][1] + 'm';