bombela / backward-cpp

A beautiful stack trace pretty printer for C++
MIT License
3.75k stars 479 forks source link

add support color on Windows #302

Closed mariuszmaximus closed 1 year ago

mariuszmaximus commented 1 year ago

obraz

flagarde commented 1 year ago

colors from terminal sequences are not automatically understood by Windows https://learn.microsoft.com/en-us/windows/console/setconsolemode

bombela commented 1 year ago

Does it work with cmd.exe, the Windows Terminal and some other terminal like Alacrity? Does using "cmd.exe" shell changes anything in those three vs PowerShell vs bash for example?

flagarde commented 1 year ago

I'm fighting with this too :(. Seems that for the standard terminal in windows the feature need to be activated and it is only available starting from some Windows 10 version AND the terminal shouldn't be turned into "legacy mode" (Windows😂).

Newer terminal seems to support it but it's better to test. I did some test on this to implement the switch automatically for a terminal library (https://github.com/jupyter-xeus/cpp-terminal) but it need more tests

flagarde commented 1 year ago

There is an old API ou can use to do colors on windows that works for all versions but it's very different from color escape code

mariuszmaximus commented 1 year ago

I create patch on W11 Now I have W10 and no colors :( Close the thread/pull?

flagarde commented 1 year ago

Maybe use the old api. More difficult but it should be possible if you really want color