Repository navigation
Fix terminal text contrast with images enabled on opaque themes - #340776
Open
Davlatjon Sh (dalisoft) wants to merge 2 commits into
Open
Davlatjon Sh (dalisoft) wants to merge 2 commits into
Davlatjon Sh (dalisoft) wants to merge 2 commits into
Conversation
Derive glyph transparency from the effective terminal background instead of image support. Keep image alpha independent and cover image/font configuration and theme changes in regular and detached terminals. AI-assisted fix contributed by @dalisoft; implementation, investigation and validation generated with OpenAI Codex. Fixes microsoft#338199 Fixes microsoft#299442
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
Contributor
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation is well covered, with only a non-blocking inline-comment cleanup remaining.
1 open finding
What changed in this PR
Fixes terminal text contrast by deriving glyph transparency from the effective terminal background rather than image support.
Changes:
- Updates transparency during terminal creation and theme changes.
- Removes outdated image-setting documentation.
- Adds opaque/translucent theme regression coverage.
| File | Description |
|---|---|
xtermTerminal.ts |
Derives transparency from background opacity. |
terminalConfiguration.ts |
Updates image-setting documentation. |
xtermTerminal.test.ts |
Tests configuration and theme transitions. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…le comment to one line' Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This was referenced Oct 9, 2026
This branch has not been deployed
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.

Enabling
terminal.integrated.enableImagescurrently forcesallowTransparency: true, including on opaque terminal backgrounds. On Quiet Light this changes normal glyph weight and turns dim text nearly white. Both reports share this configuration-dependent regression; the #338199 reproduction already usesterminal.integrated.fontRendering: "grayscale".This change derives glyph transparency from the effective terminal background instead. Opaque themes retain the same text-rendering path with image support on or off; translucent backgrounds use the alpha path. Image pixels retain their own canvas alpha.
Fixes #338199
Fixes #299442
AI disclosure and attribution: AI-assisted fix contributed by Davlatjon Sh (@dalisoft). The implementation, investigation, regression tests, and validation were AI-generated with OpenAI Codex under Davlatjon Sh (@dalisoft)'s direction. The description and screenshots identify the automated validation and its platform limits.
Changes
allowTransparencyfrom the effective background color at terminal construction and theme updates, using the same color provider as the xterm theme. This includes terminal/editor/panel/sidebar background fallbacks.The image addon uses separate alpha-enabled image canvases. Real RGBA Kitty/iTerm images with opaque, partial-alpha, and zero-alpha regions still render, and SIXEL still decodes. Negative-z Kitty layers remain present on translucent backgrounds; returning to an opaque background restores the original opaque capture exactly.
The investigation also covered the linked font-rendering work in #337208 / #335625, the duplicate #300536, the similar Linux report #240774, and the image-transparency motivation in #295634 / #295701 / #308691 and RGBA report #297073.
Before / after
These captures use the repository-pinned xterm, WebGL, and image addons on Quiet Light. Both have image support enabled. The before capture reproduces the former unconditional glyph transparency; the after capture uses the fixed opaque-background path. They contain regular, dim, bold, italic, and ANSI-colored text.
The fixed path also renders the transparent PNG sectors and hole correctly through the real iTerm protocol:
Validation and complete evidence
The published evidence was checked for credentials, private keys, email addresses, and private settings; none were found. The local workspace path in the Electron log is sanitized, with test results unchanged. All final screenshots, measurements, observations, logs, source provenance, and SHA-256 hashes are retained in an immutable evidence commit. The source PR changes only three files; the proof lives on a separate branch of Davlatjon Sh (@dalisoft)'s fork so it remains available after local temporary files are removed.
XtermTerminalsuiteXtermTerminalsuitegit diff --checkTests and captures ran on Linux. Electron unit tests used Xvfb with GPU disabled and a mocked WebGL renderer; the separate pixel harness used the real pinned WebGL and image addons with Chromium software WebGL. These are focused renderer captures, not native macOS or full-workbench screenshots. The DPR 1 protocol captures combine text and images; supplementary DPR 2 protocol captures omit text and are separate from the full DPR 2 text comparisons.
The source branch was rebased onto current upstream
main; the terminal code, addon loader, and dependency lockfiles used for validation are unchanged by that rebase. Exact commits and dependency versions are recorded in provenance and capture notes.How to test
Run the targeted checks:
For a manual check, use Quiet Light with the reported configuration:
{ "workbench.colorTheme": "Quiet Light", "workbench.fontAliasing": "antialiased", "terminal.integrated.gpuAcceleration": "on", "terminal.integrated.fontRendering": "grayscale", "terminal.integrated.enableImages": true, "terminal.integrated.fontFamily": "JetBrains Mono, Fira Code, Monaco", "terminal.integrated.fontSize": 14 }Open a terminal and print normal/dim/bold/italic/colored text, then toggle image support and reopen the terminal for each setting:
Expected: on an opaque background, enabling images keeps the same text contrast and weight. Check a dark theme too, render an RGBA image with Kitty/iTerm and a SIXEL image, and switch the terminal background between opaque and translucent. Image alpha remains independent of opaque text rendering.