-
Notifications
You must be signed in to change notification settings - Fork 280
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
available_color_count is wrong on Windows #882
Comments
For that matter, just checking |
heaths
added a commit
to heaths/crossterm
that referenced
this issue
May 4, 2024
heaths
added a commit
to heaths/crossterm
that referenced
this issue
May 4, 2024
heaths
added a commit
to heaths/crossterm
that referenced
this issue
May 4, 2024
heaths
added a commit
to heaths/crossterm
that referenced
this issue
May 7, 2024
Fixes crossterm-rs#882 by improving `style::available_color_count()`: - Checks ANSI support on Windows. - Uses the COLORTERM environment variable and falls back to the TERM environment variable. - Supports "xterm-24bit" and "truecolor" values which return `u16::MAX`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Windows pseudo-TTYs support true color, yes
crossterm::style::available_color_count
reports 8. You need to query if you're in a pseudo-terminal which, BTW, means you can do just about any VT100 sequence including keyboard support, though I'm not sure what "progressive keyboard support" means.A better detection of what colors are supported can be found at https://github.com/cli/go-gh/blob/dbd982eba2a041d88d398cce01cb708c4c3503f7/pkg/term/env.go#L70-L72. I worked on that for the GitHub CLI (was refactored into cli/go-gh from cli/cli) along with colleagues on the Windows terminal team that own conhost and conpty - both of which support VT100 sequences since some version of Windows 10 (TH2, maybe? Anything older isn't supported anyway.)
To Reproduce
Steps to reproduce the behavior:
cargo run
Expected behavior
256
is printed to stdout.OS
Terminal/Console
The text was updated successfully, but these errors were encountered: