0
votes

To set my terminal theme, I typically use a script which prints ANSI control sequences. For example,

echo -e "\033]11;rgb:20/20/30\033\\"

sets the background color to RBG #202030. This works with git-bash+mintty, and it works with WSL+Windows Terminal. Unfortunately, it does not work with git-bash+Windows Terminal. Instead, it just outputs a \ with no change to the color scheme.

Does anyone have ideas for troubleshooting this?

A couple things I've tried:

  • Try to output colored text, e.g., echo -e "\033[44m\033[37m Test \033[0m". This works just fine.
  • Check the $TERM environment variable. It is equal to xterm-256color, just the same as in WSL (which works).

In case it matters, here's the command setting I'm using in Windows Terminal to launch git bash:

"commandline": "C:/Program Files/Git/usr/bin/bash.exe -i -l",
2

2 Answers

1
votes

Your issue seems local to your environment. Ensure you are using the latest version of Windows Terminal and git bash and perhaps reinstall them. I am an running Windows Terminal 1.0.1401.0 and git bash installer 2.27.0 (installed with no PATH modifications and no expiremental settings) and I can change the background of the terminal in Windows Terminal using the command: echo -e "\033]11;rgb:20/20/30\033\\.

0
votes

I suggest using a custom color scheme in settings.json for Windows Terminal as it's persistant and fully customizable using hex color codes.

In settings.json:

  1. After your line "commandline": "C:/Program Files/Git/usr/bin/bash.exe -i -l", add a new property: "colorScheme": "Nicks",. If it is the last property in the object then remove the comma.
  2. After the entire profiles property add a schemes property with an object something like this:
    "schemes": [
        {
            "name" : "Nicks",
            "background" : "#202030",
            "black" : "#282C34",
            "blue" : "#61AFEF",
            "brightBlack" : "#7FB323",
            "brightBlue" : "#00AFEF",
            "brightCyan" : "#56B6C2",
            "brightGreen" : "#AAD76F",
            "brightPurple" : "#CEE066",
            "brightRed" : "#FC7474",
            "brightWhite" : "#DCE4DF",
            "brightYellow" : "#22F901",
            "cyan" : "#70E8F8",
            "foreground" : "#CAE0AC",
            "green" : "#6A8854",
            "purple" : "#C678DD",
            "red" : "#FB4242",
            "white" : "#DCDFE4",
            "yellow" : "#E5C07B"
        }
    ],

If schemes is the last property in the object then remove the comma.

Save the file and the changes should take effect instantly without having to reload the shell.