Closed jkrems closed 10 years ago
@EndangeredMassa Thoughts or opinions on the way this gets the job done? It's one of those sad problems to have, and also sad ways to address it, given the lack of a non-api-surface way of setting preferences like this. Lacking other input, I'm a +0, as I assume this does cause pain somewhere for some people.
A README mention of some sort would probably be in order, though.
One possible other way to solve this that works at least for my use case is to check process.stdout.isTTY
and auto-disable colors when it is either not present (e.g. in a browser) or is not true.
I think that the process.stdout.isTTY
solution would work best.
Updated to just check for isTTY
and disable colors if it's not true.
Looks fine to me.
Doesn't the chalk
module handle all this stuff and more? (Or are you looking to avoid dependencies?)
This module is browser friendly without being opinionated about bundling right now (e.g. it doesn't depend on browserify
). Adding a dependency on chalk would change that (most likely).
Yep, pretty sure this is the way to go – thanks!
Released in v1.4.0
. Seems github has commit message auto-close magic for "fixes #8" but not for "addresses #8". :-)
Oh, that was a PR comment, never mind.
Addresses #8 - not all environments are fans of ansi colors.