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

Fix terminal color on Windows #58

Closed

Conversation

Dreeam-qwq
Copy link

Fix terminal color on Windows to close Paper#11637.

There is no %TERM% or %COLORTERM% environment variables set by default on Windows system, also, the %WT_SESSION% variable won't always exist in terminal for some reason on Windows 10+, so the ColorLevel#compute will return no color for most of circumstances on Windows. But we can assume that terminals on Windows always support the truecolor and just do a simple check to detect whether the terminal is on Windows.

Tested on Windows Server 2012 R2 / Windows Server 2019 / Windows 10 / Windows 11, Windows cygwin, and all work fine, the color come back, and can show the correct hex color it should be.

@zml2008
Copy link
Member

zml2008 commented Dec 1, 2024 via email

@zml2008
Copy link
Member

zml2008 commented Dec 1, 2024

cc @MiniDigger i think this PR is redundant

@Dreeam-qwq
Copy link
Author

Dreeam-qwq commented Dec 1, 2024

cc @MiniDigger i think this PR is redundant

Yes, I think most of situtation this pr is redundant, since System#console is not null most of time, and in it, the level will fallback to index16, I didn't know this change not updated in Paper yet (((

But the core idea in this pr is that just assume all terminals on Windows support truecolor, and display the correct hex color, not index16

@MiniDigger
Copy link
Member

But the core idea in this pr is that just assume all terminals on Windows support truecolor

what do you base that assumption on? i.e., powershell doesn't support truecolor:
image

@Dreeam-qwq
Copy link
Author

But the core idea in this pr is that just assume all terminals on Windows support truecolor

what do you base that assumption on? i.e., powershell doesn't support truecolor: image

That’s strange, I remember it should work (? I will test again tomorrow (

@Dreeam-qwq
Copy link
Author

Dreeam-qwq commented Dec 2, 2024

But the core idea in this pr is that just assume all terminals on Windows support truecolor

what do you base that assumption on? i.e., powershell doesn't support truecolor: image

idk, it seems works fine on my side?
image
image

Oh, that's powershell ISE doesn't support
Closed anyway

@Dreeam-qwq Dreeam-qwq closed this Dec 2, 2024
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.

Console colors no longer showing post Jline fix.
3 participants