Set COLORTERM=truecolor in the environment of new connections - #20420
Open
UditDewan wants to merge 2 commits into
Open
Set COLORTERM=truecolor in the environment of new connections#20420UditDewan wants to merge 2 commits into
UditDewan wants to merge 2 commits into
Conversation
Client applications commonly check the COLORTERM environment variable to decide whether to emit 24-bit color escape sequences. Windows Terminal has always supported 24-bit color, so advertise it the same way other truecolor-capable terminal emulators do. COLORTERM is also added to WSLENV so that the variable is visible inside WSL sessions, where most COLORTERM-aware tools run. Closes microsoft#11057
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
Member
|
You'll need to fix the "check-spelling" issue if we are to accept this. :) |
Author
|
Fixed — added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Sets
COLORTERM=truecolorin the environment of every new ConPTY connection, alongside the existingWT_SESSIONandWT_PROFILE_IDvariables.COLORTERMis also added to the built-inWSLENVlist so the variable propagates into WSL sessions, where mostCOLORTERM-aware tools run.References and Relevant Issues
#11057 — maintainers indicated they're on board with setting
COLORTERM(#11057 (comment)). #13687 was closed as a duplicate of it.Detailed Description of the Pull Request / Additional comments
Many client applications (gh, oh-my-zsh, onefetch, etc.) check
COLORTERMfor the valuetruecolorto decide whether to emit 24-bit color escape sequences, and fall back to 256/16-color output when it's unset. Windows Terminal has always supported 24-bit color, so it advertises it the same way other truecolor-capable terminal emulators do (see https://github.com/termstandard/colors).The variable is set before the profile's custom
environmentmap is applied, so users can still override or clear it per-profile if they need to.Validation Steps Performed
Code inspection: the new variable is set via the exact code path used for
WT_SESSION/WT_PROFILE_ID, andWSLENVhandling already dedupes against user-specified entries. After building,echo $env:COLORTERM(PowerShell) andecho $COLORTERM(WSL) should both printtruecolor.PR Checklist