10

I'm running Git Bash on Windows 10 Creators Update build 15063. During the installation of Git for Windows I chose to Use Windows' default console window instead of MinTTY.

The default console window means cmd.exe, also known as the Command Prompt or Command Processor. Since build 14931 of Windows 10 cmd.exe supports 24-bit colour.

How can I 'unlock' the new 24-bit colour support in Windows 10 Creators Update for Git Bash?

Since cmd.exe also supports ANSI escape codes now, I tested 24-bit colour support in cmd.exe (not Git Bash) using the following command:

echo ^[[48;2;0;191;243m^[[38;2;255;255;255m Ask Question ^[[0m

(The character sequence ^[ are actually the visual representation of the escape control character, which I entered using Ctrl+[.)

24-bit color support in cmd.exe

I tested 24-bit colour support as well as 'normal' 8-colour support in Git Bash using the commands below. Git Bash only outputs colours when using the basic (non-extended) ANSI escape codes.

echo -e "\033[48;2;0;191;243m\033[38;2;255;255;255m Ask Question \033[0m"

echo -e "\033[44m\033[37m Ask Question \033[0m"

Git Bash

Changing the value of the TERM environment variable from cygwin to xterm-256color did not fix it.

  • "Changing the value of the TERM environment variable from cygwin to xterm-256color did not fix it." That is to be expected. A windows console window is not an xterm window. – DavidPostill Jul 8 '17 at 11:04
  • echo -e "\033[48;2;0;191;243m\033[38;2;255;255;255m Ask Question \033[0m" works for me in (Cygwin) mintty. – DavidPostill Jul 8 '17 at 11:07
  • cmd.exe is not a very good terminal application (though it has been getting better as you noted). I highly suggest mintty (which is the default "Cygwin Terminal") as noted in this mildly related answer. – Adam Katz Feb 7 '19 at 22:39
1

Upgrading Git Bash should allow it to work. If you run:

echo -e "\033[48;2;0;191;243m\033[38;2;255;255;255m Ask Question \033[0m"

It will return the corresponding color. Here is what the output text will look like:

Example showing the colored version of the text output.

To update Git Bash, just download it from the link. The installer should be able to detect that you already have Git Bash installed and it just needs to update.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.