question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Terminal doesn't take editor background color into account

See original GitHub issue

Forked off case from @sagebind in https://github.com/microsoft/vscode/issues/128295#issuecomment-952194513

I can consistently reproduce this today specifically with terminals in the editor area (similar to https://github.com/microsoft/vscode/issues/127156) as I experience it every day for the past few months. Here’s full reproduction steps:

  • Install a fresh copy of VS Code Insiders (no extensions or customizations). At time of writing I reproduced this with commit dc1a6699060423b8c4d2ced736ad70195378fddf.
  • Install a theme with a different background color for panel terminal and editor. In this case, https://marketplace.visualstudio.com/items?itemName=swashata.beautiful-ui. Note that this is a theme pack, but can be reproduced with most themes in this pack. The theme shown below is βui - One Dark.
  • Create a new terminal in the editor area.
  • Ensure that GPU acceleration is on (terminal.integrated.gpuAcceleration).
  • Observe the background color discrepancy:
Screen Shot 2021-10-26 at 1 12 41 PM

Using the developer tools, you can see that while .editor-container has an inline style of background-color: rgb(38, 42, 49);, the inner element .xterm-viewport has the inline style of background-color: rgb(24, 26, 30);, which does not match the editor area.

Screen Shot 2021-10-26 at 1 16 14 PM

Somehow the setting terminal.integrated.gpuAcceleration is actually involved here, because when changed to off, suddenly everything looks correct:

Screen Shot 2021-10-26 at 1 18 14 PM

Though the background color of the inner element .xterm-viewport is still the wrong value, it seems to no longer have an impact. I am presuming this is still a VS Code bug, but I suppose that somehow this could be an issue with the theme itself though I’m not sure how.

This test was done on macOS 11.6.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
gukandrewcommented, Dec 14, 2021

Same here on apple silicon (MBP 2020 m2).

"terminal.integrated.gpuAcceleration": "off"

fixed problem, but for sure it’s not best solution 😦

1reaction
sagebindcommented, Nov 8, 2022

So basically, the only reason that setting terminal.background “fixes” the problem is because it causes the terminal to use terminal.background as the background color instead of editor.background, and causes it to actually become the same as editorPane.background via alpha transparency. But if the terminal defaults to editor.background in a terminal editor, I would expect the margin around the terminal to also be editor.background, not editorPane.background.

I think enabling Zen Mode helps visually show why the current behavior is wrong:

Screen Shot 2022-11-08 at 14 16 06

(Of course, in all places where editor.background is being used here, I’d expect it to probably use terminal.background instead if set.)

It seems like at the very least, the bug starts here:

https://github.com/microsoft/vscode/blob/dec7735080b74f3d8eba8d0bcb0a1c0d96f96c1f/src/vs/workbench/contrib/terminal/browser/media/terminal.css#L63-L65

In light of https://github.com/microsoft/vscode/issues/127156 I’d expect this to be

    background-color: var(--vscode-terminal-background, --vscode-editor-background); 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Terminal: Console output background color setting is not ...
Go to Editor -> Color Scheme -> Console Colors and change ANSI Colors -> Red -> Foreground to something like 880000.
Read more >
Windows Terminal Troubleshooting | Microsoft Learn
Learn fixes to common obstacles in Windows Terminal. ... Why is Acrylic opacity not making my Windows Terminal background transparent?
Read more >
How To Change Background Color and Text Selection BG in ...
vscode #visualstudiocode #settings This tutorial shows you how to change background color in VSCode. It's a highly requested subject on ...
Read more >
How to change color scheme on Windows Terminal
Under the “Colors” section, click each color and select the hex color you want for the foreground, background, cursor color, selection ...
Read more >
Terminal Appearance in Visual Studio Code
Terminal colors. While the terminal is capable of displaying true color, programs commonly use 8 ANSI colors (black, red, green, yellow, blue, magenta ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found