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

[BUG] Text Color Not Adapting to Dark Mode in Windows 11 Terminal #3227

Closed
kaidaniel82 opened this issue Dec 9, 2023 · 5 comments
Closed

Comments

@kaidaniel82
Copy link

Operating System: Windows 11 Pro
Python Version: 3.11
Rich Library Version: 13.7

Problem Description:
When I execute the following line in the terminal, the text remains black even when the terminal switches to Dark Mode, which has a black background. This makes the text unreadable.

Code where the issue occurs:

right_panel_content = Text( f"Internet: {app_status['internet']}\n", style="black")
Panel(right_panel_content, title=Text("Connectivity Center", style="bold"))

On the other hand, the following code will automatically adjust the text color to white when the display mode automatically switches to Dark Mode:

right_panel_content = f"License Name: {license_status['product_name']}\n"
Panel(right_panel_content, title=Text("License Center", style="bold"))
Copy link

github-actions bot commented Dec 9, 2023

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

Only the default foreground and background colors behave this way. The terminal will pick the appropriate shade, but some combinations are never going to work well. Like black on a dark background.

@kaidaniel82
Copy link
Author

Does that mean that no matter what color I set in the following code, it will never adjust?

Text(f"Internet: {app_status['internet']}\n", style="black")

@willmcgugan
Copy link
Collaborator

Rich writes code that says make the foreground color black. It's your terminal that decides on the exact shade you get. You can configure your terminal to adjust theme colors. So you could change black to a dark grey or a different color entirely.

Copy link

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants