Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colors.color(string) not working when using with Grunt #102

Closed
mgingras opened this issue Jan 20, 2015 · 4 comments
Closed

colors.color(string) not working when using with Grunt #102

mgingras opened this issue Jan 20, 2015 · 4 comments

Comments

@mgingras
Copy link

Running a nodejs application through Grunt I noticed that strings colored using color(string) were not colored, however, by using string.color the color was picked up.

@pksunkara
Copy link
Contributor

Since, the stdout is not a TTY, colors will be disabled. Check the code here. I assume that grun takes the output from colors and then prints it. You must use colors.enabled option once you require this module to enable colors even though the stdout is not a TTY.

@pksunkara pksunkara changed the title colors.color(string) does not behave the same way as string.color colors.color(string) not working when using with Grunt Jan 24, 2015
@Marak
Copy link
Owner

Marak commented Jan 24, 2015

@pksunkara - You should review the code path for supports colors and https://github.com/Marak/colors.js/blob/master/lib/extendStringPrototype.js to ensure that colors support is being correctly applied to both APIs.

It would also be good to add test coverage for this.

@Marak Marak reopened this Jan 24, 2015
@pksunkara
Copy link
Contributor

I actually merged a fix related to this in #97

@pksunkara
Copy link
Contributor

@mgingras Related to what @Marak was saying, both the stringPrototype and the normal api works the same now, both shouldn't be printing colors now. I guess my first comment can be confusing without this context.

So, if you want colors to be printed for either of the api, you need to use the enabled option.

kingcody added a commit to kingcody/bunyan-debug-stream that referenced this issue Sep 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants