Skip to content

Commit

Permalink
Document colors.enable() and .disable() (#255)
Browse files Browse the repository at this point in the history
Resolves #251 requesting documentation for the enable/disable functions. This documents them in the readme. My explanation doesn't really fit the tone of the rest of the readme, so I'm open to changing the wording
  • Loading branch information
mrjacobbloom authored and DABH committed Sep 22, 2019
1 parent acb7f66 commit a1407ae
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Expand Up @@ -94,12 +94,27 @@ I prefer the first way. Some people seem to be afraid of extending `String.proto

If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.

## Disabling Colors
## Enabling/Disabling Colors

To disable colors you can pass the following arguments in the command line to your application:
The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:

```bash
node myapp.js --no-color
node myapp.js --color=false

node myapp.js --color
node myapp.js --color=true
node myapp.js --color=always

FORCE_COLOR=1 node myapp.js
```

Or in code:

```javascript
var colors = require('colors');
colors.enable();
colors.disable();
```

## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
Expand Down

0 comments on commit a1407ae

Please sign in to comment.