-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[REQUEST] Forcing ANSI #890
Comments
You can construct the Console like this to generate ANSI regardless of environment: console = Console(force_terminal=True, color_system="truecolor") I think there is an env var that indicates if running on GH Actions, or maybe you can define one. |
Looks like it doesn't work? I just tried it. The code was pretty much simple though logger = logging.getLogger(__name__)
custom_theme = Theme(
{
"log.level": "magenta",
"repr.number": "bold green blink",
"log.message": "white on red",
"logging.level.info": "green on white",
"logging.level.notset":"red on white"
},
)
console=Console(theme=custom_theme, force_terminal=True, color_system="truecolor")
logger.addHandler(
RichHandler(
show_time=False,
show_path=False,
console=console,
rich_tracebacks=True
)
) I could see no coloured output in GHA or ANSI locally on Git Bash(#330), where if ANSI is printed it should be turned into colours. |
That does work. Try printing os.environ or running |
I haven't actually, made it based on an environment variable. That is a script is meant to be run in CI so I just forced it. |
Ah, you're on Windows. Try also setting |
I am sorry I didn't say this beforehand.
I did it naveen521kk/msys2-updater@bd834de but there isn't any colour there https://github.com/naveen521kk/msys2-updator/runs/1669125766?check_suite_focus=true#step:6:11 |
Try logging |
See this |
I suspect that colorama may be stripping out ansi codes, even when legacy_windows is False. I'll look in to it. |
Any updates? |
Can’t do much about this without reinventing colorama. I may revisit this issue in future. |
Maybe I will make an issue on Colorama about this? Asking them to check for an environment variable? |
looks like there is a PR upstream tartley/colorama#230 |
Update: I just did a regular dependency update and this seems to be fixed naveen521kk/msys2-updater@4a34e98. https://github.com/naveen521kk/msys2-updator/runs/2739486117?check_suite_focus=true#step:10:284 (I was happy without those colours though) |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry for the noise! I'm stupid! :) Instead of |
Have you checked the issues for a similar suggestions? YES
I need an Environment variable which forces ANSI output whatever the system may be.
This is particularly useful in GitHub Actions, where it doesn't show any colored output, currently, but setting that a environment variable should print colors.
Is it currently possible to do now?
The text was updated successfully, but these errors were encountered: