4

When I'm using VS Code's integrated bash terminal I don't have any of the normal bash coloring schemes, all of my text is simply white. If I use git bash outside of VS Code, I get all of the normal directory colorings.

I tried the accepted answer here as well as the others mentioned in the same post but nothing worked. I also made sure to have my bash terminal profile set to the correct exe file but that hasn't worked either. I've also read through VS Code's new documentation on terminal profiles but I think mine is set up correctly. I don't know what else to check at this point, everything looks to be correct. Does anybody have any ideas?

Here are my terminal settings:

    "terminal.integrated.defaultProfile.windows": "Command Prompt",
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash",
            "icon": "terminal-bash",
            "path": "C:\\Program Files\\Git\\bin\\bash.exe"
        }
    }

Here is a picture showing Git Bash, VS Code's settings, and my VS Code Bash terminal.

Bash inside VSC:

$ echo $COLORTERM
truecolor
$ echo $PS1
\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$
$ echo $TERM
xterm-256color

Bash outside VSC:

$ echo $COLORTERM

$ echo $PS1
\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$
$ echo $TERM
xterm
John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Hiebs915
  • 666
  • 1
  • 7
  • 22
  • have you tried a different theme, if they don't specify the terminal colors, I use `Default Light+` and it uses colors in Git Bash (you have to customize the colors a few shades darker), `One Dark Pro` too I think – rioV8 Jul 28 '22 at 21:26
  • Yes, I tried changing my VS Code theme but it didn't make a difference. I'm using `Monokai` and switched to `Light + (default Light)` but the terminal stayed the same. – Hiebs915 Jul 29 '22 at 12:40
  • what is the value of environment variables: `COLORTERM` and `PS1` inside the VSC terminal – rioV8 Jul 29 '22 at 14:34
  • @rioV8 Where would I check these? I haven't seen something like this before. – Hiebs915 Aug 01 '22 at 12:34
  • **environment variables** : `set` – rioV8 Aug 01 '22 at 13:15
  • @rioV8 In settings.json? If so, I don't see any references to environment variables. – Hiebs915 Aug 01 '22 at 13:30
  • what does `${env:windir}` mean in your settings – rioV8 Aug 01 '22 at 17:22
  • tbh, I'm not too sure. I was trying to set up terminal profiles because that's what VS Code docs recommended. I thought if I specifically told VS code where to look for the bash.exe file it would start using the right color scheme. – Hiebs915 Aug 01 '22 at 19:08
  • it is determined by the configuration of the shell – rioV8 Aug 01 '22 at 20:14
  • Run `echo $COLORTERM`, `echo $PS1`, and `echo $TERM` inside the VSCode terminal. Compare them to what gets printed outside VSCode. Are they the same or is something different? – John Kugelman Aug 01 '22 at 21:08
  • @JohnKugelman If I echo out what you're asking for, I get back the same thing inside VSC and the CMD prompt outside of VSC. Do I just pull up a regular cmd terminal in VSC and type "echo $COLORTERM" etc.? – Hiebs915 Aug 01 '22 at 22:47
  • In the image you compare Git Bash with VSC terminal and you type commands in windows cmd terminal – rioV8 Aug 02 '22 at 07:23
  • You're asking about the Bash terminals, so in the two bash terminals you're asking about, not in cmd! – joanis Aug 02 '22 at 12:22
  • The visual appearance of your prompt, including colouring, is determined by the value of `PS1`. We're asking to show us what `echo $PS1` outputs in your two terminals, so that we can see how you're configured. `COLORTERM` and `TERM` also have an impact, so showing those as well will help. – joanis Aug 02 '22 at 12:32
  • @joanis I put everything you asked for in the question. – Hiebs915 Aug 03 '22 at 12:34
  • 1
    Thanks! And darn... that's exactly like on my computer, yet I get colors correctly in both Git Bash and in VSCode bash terminal. So we're back to your VSCode config - your Bash settings are set correctly, but I have no idea what VSCode setting might cause this, sorry! – joanis Aug 03 '22 at 15:13
  • One thing you can try is delete your settings.json file (keep a backup first!) and try to restore VSCode defaults. Mine has nearly no customizations, so the defaults should have the colors correctly. If the colors work then, put back in one thing or block at a time until you figure out what line is the problem. – joanis Aug 03 '22 at 17:58

1 Answers1

5

I got it working! I took @joanis's advice and started resetting chunks of my VSC settings and narrowed it down to the Minimum Contrast Ratio setting. I don't know why but mine was set at 21. The default is 4.5. Once I changed mine to default, the git bash terminal colors showed up!

enter image description here enter image description here

Hiebs915
  • 666
  • 1
  • 7
  • 22