I've been playing around with the Windows Poweshell vs mintty and various colorisation options.
In this respect mintty is superior, but it doesn't display the (ANSI?) color escape sequencies when running ColorTool from mintty shell like this:
# ColorTool.exe -c
40m 41m 42m 43m 44m 45m 46m 47m
m gYw gYw gYw gYw gYw gYw gYw gYw gYw
1m gYw gYw gYw gYw gYw gYw gYw gYw gYw
30m gYw gYw gYw gYw gYw gYw gYw gYw gYw
1;30m gYw gYw gYw gYw gYw gYw gYw gYw gYw
31m gYw gYw gYw gYw gYw gYw gYw gYw gYw
1;31m gYw gYw gYw gYw gYw gYw gYw gYw gYw
32m gYw gYw gYw gYw gYw gYw gYw gYw gYw
1;32m gYw gYw gYw gYw gYw gYw gYw gYw gYw
33m gYw gYw gYw gYw gYw gYw gYw gYw gYw
1;33m gYw gYw gYw gYw gYw gYw gYw gYw gYw
34m gYw gYw gYw gYw gYw gYw gYw gYw gYw
1;34m gYw gYw gYw gYw gYw gYw gYw gYw gYw
35m gYw gYw gYw gYw gYw gYw gYw gYw gYw
1;35m gYw gYw gYw gYw gYw gYw gYw gYw gYw
36m gYw gYw gYw gYw gYw gYw gYw gYw gYw
1;36m gYw gYw gYw gYw gYw gYw gYw gYw gYw
37m gYw gYw gYw gYw gYw gYw gYw gYw gYw
1;37m gYw gYw gYw gYw gYw gYw gYw gYw gYw
# Whereas this works:
# /cygdrive/c/Program\ Files/PowerShell/6/pwsh.exe -c "'?[1;31mRed ?[32mGrn ?[33mYel ?[35mMag ?[36mCya ?[m'.Replace('?', [char]27);"
Red Grn Yel Mag Cya
# But this doesn't:
# /cygdrive/c/Program\ Files/PowerShell/6/pwsh.exe -c "write-host -fore Cyan This is Cyan text"
This is Cyan text
I'm using PS 6.1.1 and 5.1.14409.1005
It looks that ColorTool uses Console API to set the color, not escape sequences. It won't work on mintty.
... unless you would wrap it in winpty which bridges the console and tty worlds
It looks that ColorTool uses Console API to set the color
There is also the -x that is supposed to send VT codes
-x, --xterm : Set the colors using VT sequences. Used for setting the colors in WSL. > Only works in Windows versions >= 17048.
Who could I bother so that they send the escape codes?
unless you would wrap it in winpty which bridges the console and tty worlds
Ok how do I go about that?
Download winpty from https://github.com/rprichard/winpty, install it to /bin.
Then call winpty YOUR_PROGRAM.
Is that project still maintained? No releases for years and no bug fixes for months with poor building instructions.., IDK why I should bother?
winpty is maintained, the build instructions work, and you don't have to bother unless you want to translate window console color APIs to the ansi escape sequences which would work in mintty.
@avih
Ok thanks. But I'm thinking there is something fishy here. Why wouldn't the Windows Console color API have already been translated into escape sequences. It must have been around for a good ~20 years by now.
Because they work in completely different ways, and mintty is intended to work the *nix way and not the windows way. The *nix way is by printing special characters (escape sequences) to the output which are interpreted by the terminal as various instructions (move the cursor, change color, etc), while the windows way is to call console windows function calls to control cursor, colors, etc.
These are completely different mechanisms, and winpty translates from the windows one to the *nix one.
Actually, winpty does translate console colours into terminal colours. Whether that would not work with ColorTool for some reason, I cannot test because there is no binary.
Background has been discussed, marking as "question" and closing.
Think this may be the MS Windows MS ColorTool docs:
https://blogs.msdn.microsoft.com/commandline/2017/08/11/introducing-the-windows-console-colortool/
source:
https://github.com/Microsoft/console/tree/master/tools/ColorTool
release:
https://github.com/Microsoft/console/releases
As expected, ColorTool -c shows a colour foreground/background matrix when run in winpty.