Coloring library for console strings
Dye is a coloring/styling library for wrapping common ANSI escape sequences around text that produce colors/styling when sent to
stdout. It also comes with a customizable zalgolizer
The interface mostly mirrors the popular
colors module on
npm, but does not introduce implicit global dependencies in your code via
String.prototype, and has been cleaned up for terminal use only.
Basic usage is simply
dye.red(str). All the exported colors with
bold (aka bright) variants should work everywhere. Here we test all the methods in both variants.
var dye = require'dye';var cols = 'white' 'black' 'grey' 'blue' 'cyan' 'green' 'magenta' 'red''yellow';colsforEachvar colored = dyecolcol;console.logcolored;console.logdyeboldcolored;;
italic functions have sparse support (no worky on windows).
This is a uniform-clustered zalgolizer. It picks up to a specified number of symbols from each subarray of souls at uniform randomness (with probability
p), or picks from it no symbols at all (with probability
The probability lets you specify how clustered you want the symbols (
p=1 ⇒ completely uniform distribution,
p=0.5 ⇒ on average half the letters get nothing, the rest are uniformly distributed)
The different soul types contain symbols that go above, in the middle of, or underneath the text respectively.
dyezalgo'default zalgolization'; // p=.2, maxPicks = [5, 3, 5]'d̠̤̟̰efauḻt z͂̈al̊̚g͈oli̷za̪͉t̽̅i̘̪̫̼on'dyezalgo'less clustered zalgolization' 0.7 2 1 2;'l̠̇es̞̏s ̌cl̟usṯer͑eͦd ̲z̮̅aḻ̽g̞o̮l͉̉iza̐t̄iͅỏ͖n͖'dyezalgo'intense, clustered zalgolization' 0.2 10 5 10'i̛̩͖̤̯̮͠ͅn̷͟t͢en̝͎͇͙̭sͧͤͨ̓͗̾e͑̐ͫ̒ͨ̓ͮ̏̑, c̓lů͚̺̦̰̪͓͐ͯ̈ster͍̤͖͗͌̇ͨͦͥ̚é͜d̨̡͘͞ za̋ͬͫlgͧ̏ͧ̃ͫͭͯ̈̆ol̲͕̳͓͍̯̠i̢͢z̙ation͡'
A windows command line is impenetrable by zalgo and will display question marks instead.
Finally, if you would like to sanitize / attempt to exorcise such a string, you can take the difference with the characters available via the exported
$ npm install dye
Install development dependencies
$ npm install
Run the tests
$ npm test
MIT-Licensed. See LICENSE file for details.