Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

ANSI escape codes not supported on Windows CMD #24

Open
davefrancis opened this issue Oct 2, 2018 · 3 comments
Open

ANSI escape codes not supported on Windows CMD #24

davefrancis opened this issue Oct 2, 2018 · 3 comments

Comments

@davefrancis
Copy link

ANSI colour sequences are not supported on Windows and as a result the output of mlbv looks like this:

2018-10-02 Tue Series ?[90m│?[0m Score ?[90m│?[0m State ?[90m│?[0m Feeds ?[90m─────────────────────────────────────────────────────────┼───────┼───────────┼────────────────?[0m 17:00: Colorado (COL) at Chi Cubs (CHC) 1/1 ?[0m ?[90m│?[0m ?[0m ?[90m│?[0m ?[0m ?[90m│?[0m ?[0m

It would be nice to have an option to use ANSI colours in console output.

@kmac
Copy link
Owner

kmac commented Oct 2, 2018

Which terminal program are you using in Windows? is it cmd.exe?

It looks like some support for ansi colors can be enabled as of Windows 10. Some discussions on this:

Another option might be to use the ConEmu terminal emulator: https://conemu.github.io/

I don't, uh, actually have a windows installation that I can test this with. I think what I would do is add a way to turn all ansi-control characters off in the output. You won't see colours but at least you'd see non-garbled text.

@davefrancis
Copy link
Author

I've tried in cmd.exe and powershell with the same results. I have read that ConEmu supports ANSI colours, so definitely an option. I forked your repo and have been experimenting. I found this snippit https://gist.github.com/RDCH106/6562cc7136b30a5c59628501d87906f7 resolves the issue on Windows 10. For versions of windows before 10.0.14393 it may be best to turn colours off altogether. I'm happy to help with any testing if you'd like. Cheers.

@SlimJimPoisson
Copy link

IMO, the easiest way to accomplish colors is to add a DWORD (32-bit value) registry key to HKCU\Console called VirtualTerminalLevel set to 0x1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants