-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
click.echo does not force colors on Windows with color=True #2606
Comments
Windows uses a different mechanism for color than Unix. It's not possible to force it on. Or if it is, you'd need to take that up with colorama. |
I've looked into it and it seems that there is a bug in
If I change it to |
Thanks for looking. Happy to review a PR. |
FWIW, I had to skip color-based tests on Windows in a lot of my Click-based libraries: So yes, I am pretty sure there is something wrong with colors on Windows. But I never found a way to reliably fix it and find the root cause. Even with loads of hacks and workarounds in my Click Extra project, like:
So yeah, @Tyl13 is probably onto something here with his #2731 PR ! :) Related issues might include: |
Fixed by #2607 |
Using
click.echo(click.style("Foo", fg="red"), color=True)
on Windows will not print "Foo" in red if the output is not a terminal that supports colors, so it seems thatcolor=True
is ignored on Windows.Here is an example code to reproduce the bug:
After running it on Linux the third line of
click_echo.txt
will contain the ANSI color codes but on Windows all three lines will be the same (the behavior is the same ifecho
prints on the console and the script output is redirected to a file)Environment:
The text was updated successfully, but these errors were encountered: