VS Code terminal colors are screwy

2020-03-20 04:34发布

问题:

I'm using the default theme. The terminal's colors are impossible to read, make no sense, and are inconsistent. I've tried switching themes but they're terrible in all the themes.

Here's what it looks like in the default. Are you able to read my yellow input against the gray background? And why isn't there a black background everywhere?

I realize there are settings that can manually set the fore/background colors. But I'm thinking something is broken for me because of how screwy the terminal behaves.

For example, here's what I see when I first start the terminal, type a bunch of stuff, backspace to delete half of it, resize the terminal pane, then delete some more. Notice how some of the deleted spaces have yellow and some have gray. Also notice how the area where the CWD would be shown is all black.

Here are the contents of my settings.json file:

{
    "window.zoomLevel": 0,
    "git.enableSmartCommit": true,
    "workbench.startupEditor": "newUntitledFile"
}

What needs fixing, and how?


Edit:

Just to satisfy your curiosity, I added this to my settings.json file:

"workbench.colorCustomizations": {
    "terminal.foreground": "#ffffff",
    "terminal.background": "#000000"
}

No joy:

回答1:

There might be something wrong in your console settings, you might want to remove the content of HKCU\Console in your registry. Save it before, obviously, but there shouldn't be any side effect: it'll just be recreated with the default settings.



回答2:

There are two solutions. Xavier's solution works, and mklement0's comment was also correct.

Solution #1

Do what Xavier said (and upvote his answer).

But, if you don't want to mess up registry settings (or if, like me, you have lots of registry settings nestled under the HKCU\Console root), then...

Solution #2

  1. Get Windows 10 build number 18309 (or newer)
    • Join the Windows Insider Program
    • Make sure you're on a "ring" that includes a new-enough build. For me at this moment that meant joining the "fast" ring
    • Wait forever for updates to finish installing
  2. Add "terminal.integrated.windowsEnableConpty": true to your settings.json
  3. Restart terminals
  4. Upvote mklement0's comment
  5. ...
  6. Profit!


回答3:

Okay, so here's a list of all possible settings that you could tweak in your terminal window colorscheme: (source)

    "workbench.colorCustomizations": {
      "terminal.background":"#1D2021",
      "terminal.foreground":"#A89984",
      "terminalCursor.background":"#A89984",
      "terminalCursor.foreground":"#A89984",
      "terminal.ansiBlack":"#1D2021",
      "terminal.ansiBlue":"#0D6678",
      "terminal.ansiBrightBlack":"#665C54",
      "terminal.ansiBrightBlue":"#0D6678",
      "terminal.ansiBrightCyan":"#8BA59B",
      "terminal.ansiBrightGreen":"#95C085",
      "terminal.ansiBrightMagenta":"#8F4673",
      "terminal.ansiBrightRed":"#FB543F",
      "terminal.ansiBrightWhite":"#FDF4C1",
      "terminal.ansiBrightYellow":"#FAC03B",
      "terminal.ansiCyan":"#8BA59B",
      "terminal.ansiGreen":"#95C085",
      "terminal.ansiMagenta":"#8F4673",
      "terminal.ansiRed":"#FB543F",
      "terminal.ansiWhite":"#A89984",
      "terminal.ansiYellow":"#FAC03B"
    }

Now for me, the colors of folder names was too bright over an even brighter background color that highlighted them and I couldn't read squat (that's because of my VSCode theme called NightOwl -- :P Sarah) so I thought (wrongly) to change terminal.background and terminal.foreground properties but that refer to the entire rendered window of the terminal.

Because these properties are actually named after Ansi Escape Codes, what I was actually looking for were these properties: terminal.ansiBlue for folder name text color and terminal.ansiGreen for folder name background highlight color.

As soon as I tweaked those, my terminal was good to go. The way to do it is to just set all these settings and start removing or changing them to see which is which for your preference. K Thx Bye

Also beware that terminal.ansiGreen is used by git diff as a color to show additions.