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

How to enable colorama in Gitlab tty (and other online services that seem to support colors in terminal) #214

Open
gsemet opened this issue Mar 6, 2019 · 2 comments

Comments

@gsemet
Copy link

gsemet commented Mar 6, 2019

Hi. I have been using colorama since quite a while, and I see it automatically disable itself when executed outside of a terminal, to avoid unwanted ascii string everywhere on the screen.

But since some CI such as Gitlab or Travis does support colors in their output, I wonder how colorama would be made compatible, and so identify "hum, this is not a tty on a terminal that support colors, but i recognise such or such environment and so I keep the color on". Maybe by a environment variable?

@jan11011977
Copy link

I would also like an environment variable to force Colorama to output color escape sequences, for the same reason.

@blueyed
Copy link

blueyed commented Aug 16, 2019

Seems like since 2057f03 (edit only moved there, existed before already) you could use a workaround of setting PYCHARM_HOSTED:

if 'PYCHARM_HOSTED' in os.environ:

There's also the method of using "strip=True, convert=True" directly with the AnsiToWin32 object.

I agree however that COLORAMA_FORCE_COLOR and possibly FORCE_COLOR as a fallback should be honored (instead of only "PYCHARM_HOSTED").

I've tested / looked into this for Windows builds on Travis.
With regard to that it looks like the "winterm" check (to setup the dict of conversions) is not True already likely (

winterm = None
if windll is not None:
winterm = WinTerm()
).

See also #165.

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