There seems to be a bug in Win32-OpenSSH that prevents colors to be shown in certain terminal emulators such as PuTTY and mintty.
Win32-OpenSSH seems to replace the color escape sequence "\033[32m\033[40mtest" by "\033[0;39;24;27;32;40;mtest" and the problem seems to be the last semicolon before the m. Removing this semicolon, the colors are displayed correctly.
I installed Win32-OpenSSH-Win64 (version 0.0.24.0) according to https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH.
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH\DefaultShell="C:\Program Files\GIT\bin\bash.exe" Computer\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH\DefaultShellCommandOption="-c"
Logging into my machine with
I do not get color output with PUTTY, and not with "Git Bash for Windows" but I do get colors with the native "cmd.exe" and with "Bash on Ubuntu on Subsystem for Linux" connecting to the same local server.
The problem seems to be related to unusual escape sequences. Logging all session output in PuTTY shows escape sequences that are terminated by a semicolon: "\033[0;39;24;27;32;40;mtest" and PUTTY does not seem to be able to handle them. Escape sequences without the final semicolon, e.g., "\033[0;39;24;27;32;40mtest" are handled correctly by PUTTY.
Those unusal escape sequences seem to be introduced by Win32-OpenSSH. In contrast, the Bitvise SSH Server produces the escape sequence "\033[32m\033[40mtest".