-
Notifications
You must be signed in to change notification settings - Fork 284
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
Detect Windows Terminal as a true color terminal #1200
Conversation
Windows terminal does not seem to set `COLORTERM`, but it is capable of the full range of RGB values. This detects if the `WT_SESSION` environment variable is set to determine if this session is in Windows Terminal.
So I just dove down a rabbit hole (microsoft/terminal#11057) and what I found interesting is that |
This one might be tricky. AFAIK, the only way to determine if a terminal supports truecolor is by using heuristics on environment variables, which can be somewhat 'hacky.' I've discovered this crate called supports-color, which is quite popular and should meet our needs. Unfortunately, according to the code, it states that all terminals in Windows do not support truecolor 🤔, which is not accurate. This crate is based on another project with the same name: https://www.npmjs.com/package/supports-color, and it actually does what we need. It returns 'truecolor' for Windows after a certain version chalk/supports-color#71 |
In that terminal issue one they did recommend just assuming that Windows can support true color as long as we're running on 10 (microsoft/terminal#11057 (comment)), so that certainly could be a valid option. But at the same time, I ran the |
After a bit of digging, I've found that GitHub checks if the terminal is a virtual terminal, and then falls back to Whatever the GitHub CLI does could be the way to go. It certainly has plenty of user testing. |
FYI, I've opened an issue on |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This is a bit of a stretch, but colored, with built-in color support checking, is now maintained again. IDK if we're interested in switching back and requesting improved Windows support there. |
Could be worth it, especially with colored-rs/colored#90 which could simplify the language template. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Windows terminal does not seem to set
COLORTERM
, but it is capable ofthe full range of RGB values. This detects if the
WT_SESSION
environment variable is set to determine if this session is in Windows
Terminal.
Fixes #1199