mirror of
https://github.com/flynx/colors.js.git
synced 2025-10-31 20:10:09 +00:00
[minor] included an ascii code string stripper; fixes #1
This commit is contained in:
parent
036bd80cdb
commit
5af04df3f3
@ -222,3 +222,7 @@ function zalgo(text, options) {
|
|||||||
};
|
};
|
||||||
return heComes(text);
|
return heComes(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addProperty('stripColors', function() {
|
||||||
|
return ("" + this).replace(/\u001b\[\d+m/g,'');
|
||||||
|
});
|
||||||
|
|||||||
@ -3,13 +3,16 @@ var colors = require('./colors');
|
|||||||
|
|
||||||
//colors.mode = "browser";
|
//colors.mode = "browser";
|
||||||
|
|
||||||
|
var test = colors.red("hopefully colorless output");
|
||||||
sys.puts('Rainbows are fun!'.rainbow);
|
sys.puts('Rainbows are fun!'.rainbow);
|
||||||
sys.puts('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
|
sys.puts('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
|
||||||
sys.puts('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
sys.puts('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
||||||
//sys.puts('zalgo time!'.zalgo);
|
//sys.puts('zalgo time!'.zalgo);
|
||||||
|
sys.puts(test.stripColors);
|
||||||
|
|
||||||
|
|
||||||
sys.puts(colors.rainbow('Rainbows are fun!'));
|
sys.puts(colors.rainbow('Rainbows are fun!'));
|
||||||
sys.puts(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported
|
sys.puts(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported
|
||||||
sys.puts(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported
|
sys.puts(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported
|
||||||
//sys.puts(colors.zalgo('zalgo time!'));
|
//sys.puts(colors.zalgo('zalgo time!'));
|
||||||
|
sys.puts(colors.stripColors(test));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user