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

Handle platform-specific default color for background & foreground properly #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tautcony
Copy link

@tautcony tautcony commented Jan 30, 2025

The current configuration has a noticeable issue where using the default cli theme that the background color is always black on *nix platforms, whateve the terminal background color is, e.g:

image

Currently, the default values for foreground and background colors are based on the Windows configuration. However, on *nix platforms, the situation is different; an explicit value is not set, and the value remains -1 until the application specifies one.

Based on the relevent documentations, I adjusted the default value based on the platform info.
https://learn.microsoft.com/en-us/dotnet/api/system.console.backgroundcolor?view=net-8.0#remarks
https://learn.microsoft.com/en-us/dotnet/api/system.console.foregroundcolor?view=net-8.0#remarks

image

@tautcony
Copy link
Author

tautcony commented Jan 30, 2025

However, the current CLI themes might be a bit awkward in another aspect and may need further adjustments, such as white text on a white background.

before:
image

after:
image

@tautcony tautcony force-pushed the fix/default_bg_color branch from 7b6dd2d to 1fcf4d8 Compare January 30, 2025 05:41
@calacayir
Copy link
Contributor

However, the current CLI themes might be a bit awkward in another aspect and may need further adjustments, such as white text on a white background.

That's the reason we explicitly set the background color. At the time, I remember I left it like this because being readable is more important. If I remember correctly, it's not possible to detect terminal background color in linux terminals? So we cannot adjust the themes according to the platform?

I will re-examine this.

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 this pull request may close these issues.

2 participants