-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
See #57, I think this is a duplicate (and also uses jdk internals)
…On Sat, Nov 30, 2024, at 20:18, Dreeam wrote:
Fix terminal color on Windows to close Paper#11637 <PaperMC/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.
You can view, comment on, or merge this pull request online at:
#58
Commit Summary
• d3459d7 <d3459d7> Fix terminal color on Windows
File Changes
(1 file <https://github.com/KyoriPowered/ansi/pull/58/files>)
• *M* src/main/java/net/kyori/ansi/ColorLevel.java <https://github.com/KyoriPowered/ansi/pull/58/files#diff-0c268e6f09b7e243918961266e3426519cd5f1046a2eabf937d27bbf3d70ce8c> (7)
Patch Links:
• https://github.com/KyoriPowered/ansi/pull/58.patch
• https://github.com/KyoriPowered/ansi/pull/58.diff
—
Reply to this email directly, view it on GitHub <#58>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAEZSZATHW5IFHY7SNJ3XOL2DKEXRAVCNFSM6AAAAABSZHEJ3WVHI2DSMVQWIX3LMV43ASLTON2WKOZSG4YDQNBUGE2TGMI>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
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 |
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 theColorLevel#compute
will return no color for most of circumstances on Windows. But we can assume that terminals on Windows always support thetruecolor
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.