ANSI color not working for Git Bash on Windows 10 using Windows Terminal

  ansi, python, terminal, windows

I’m using Git Bash on Windows 10 with Windows Terminal and for this Python project, the ANSI escape sequence are not working.

from colorama import init, Fore
from sys import stdout


# code ...

I tried to print a test text

# The code above
stdout.write('{GREEN}Test{RESET}'.format(GREEN=Fore.GREEN, RESET=Fore.RESET)

Here’s the output:


I’m sure that my terminal supports ANSI sequence since I’ve tested it with Bash, TS (Deno) and JS (NodeJS). They all worked. I’ve also tested on Command Prompt and it works fine for Python. Maybe this is a problem with Git Bash executing Python itself?

Source: Windows Questions