Skip to content

Set COLORTERM=truecolor in the environment of new connections - #20420

Open
UditDewan wants to merge 2 commits into
microsoft:mainfrom
UditDewan:dev/colorterm
Open

Set COLORTERM=truecolor in the environment of new connections#20420
UditDewan wants to merge 2 commits into
microsoft:mainfrom
UditDewan:dev/colorterm

Conversation

@UditDewan

Copy link
Copy Markdown

Summary of the Pull Request

Sets COLORTERM=truecolor in the environment of every new ConPTY connection, alongside the existing WT_SESSION and WT_PROFILE_ID variables. COLORTERM is also added to the built-in WSLENV list so the variable propagates into WSL sessions, where most COLORTERM-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 COLORTERM for the value truecolor to 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 environment map 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, and WSLENV handling already dedupes against user-specified entries. After building, echo $env:COLORTERM (PowerShell) and echo $COLORTERM (WSL) should both print truecolor.

PR Checklist

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

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added Issue-Task It's a feature request, but it doesn't really need a major design. Area-TerminalConnection Issues pertaining to the terminal<->backend connection interface Product-Terminal The new Windows Terminal. labels Jul 15, 2026
Comment thread src/cascadia/TerminalConnection/ConptyConnection.cpp Fixed
Comment thread src/cascadia/TerminalConnection/ConptyConnection.cpp Fixed
Comment thread src/cascadia/TerminalConnection/ConptyConnection.cpp Fixed
@github-actions

This comment has been minimized.

@DHowett

DHowett commented Jul 15, 2026

Copy link
Copy Markdown
Member

You'll need to fix the "check-spelling" issue if we are to accept this. :)

@UditDewan

Copy link
Copy Markdown
Author

Fixed — added COLORTERM and truecolor to the check-spelling expect list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-TerminalConnection Issues pertaining to the terminal<->backend connection interface Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WT should set COLORTERM

3 participants