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

Allow color in non tty shell #817

Closed
sam-mcbr opened this issue Apr 9, 2024 · 7 comments · Fixed by #818
Closed

Allow color in non tty shell #817

sam-mcbr opened this issue Apr 9, 2024 · 7 comments · Fixed by #818

Comments

@sam-mcbr
Copy link

sam-mcbr commented Apr 9, 2024

I would like to use html-proofer in a CI job, but since the running is not a TTY shell there is no color output. Would love an environment variable or command line argument to force color output. Thanks!

@gjtorikian
Copy link
Owner

Can you try setting the environment variable CLICOLOR_FORCE = '1' ?

@sam-mcbr
Copy link
Author

sam-mcbr commented Apr 9, 2024

Thanks for the quick response! Unfortunately still showing uncolored text

@gjtorikian
Copy link
Owner

Would it be possible to see how you're setting that env var, or a sample workflow?

Terminal color output is dependent on https://github.com/ku1ik/rainbow/blob/138bc054cd196b54ed6a935c52653a8ac3761dfc/lib/rainbow.rb#L10-L12

html-proofer isn't doing any TTY determination, so I'm surprised the underlying library's mechanism isn't working.

@sam-mcbr
Copy link
Author

Sorry for the delay, yeah I can share an example of how I was setting the var soon. But the reason I thought the TTY would affect this is I saw this line where Rainbow is only invoked if stdout is a TTY:

if (STDOUT_LEVELS.include?(level) && $stdout.isatty) ||

Could this be the cause of no color even with the env var set?

@gjtorikian
Copy link
Owner

I guess Rainbow updated its logic at some point, because I see now that it handles TTY/color enabling on its own.

Could you try the branch at #818 and see if that works for you?

@sam-mcbr
Copy link
Author

sam-mcbr commented May 6, 2024

@gjtorikian Apologies for the long delay, I was able to confirm that this change enables colored output!

@gjtorikian
Copy link
Owner

No worries, glad it worked, I'll send this out as 5.0.9 soon.

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

Successfully merging a pull request may close this issue.

2 participants