Marak/colors.js — Issue #14: option to disable color entirely
Author: hashar
Created: 2011-12-01 10:46:10+00:00
State: open

Hello,

On some script, it would be great to be able to disable colors entirely. For example when you run your script in a crontab, the output will be send in a plain text emails where ANSI escapes sequences might not be desirable.

Looking at the colors.js code, you define new getters for the string object. It would be great to have that code in a callable function (such as enable) and have another one that makes those getter return the plain string.

This when my script get --no-colors, I can call that disabling function and restore the string behavior. "foo".red would just return "foo".

Let me know if the above is not clear enough.