-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better Windows 10 support #36
Comments
Hi! Termenv works well in the Windows command console (cmd.exe), however you do need some magic: https://github.com/charmbracelet/lipgloss/blob/master/ansi_windows.go We're using that implementation successfully in Lip Gloss and Glow, both of which employ Termenv for ANSI coloring. |
Ahh, the magic is in Lip Gloss. 👍 |
Yeah, I'm basically already using the same trick: Just surprised this is in LipGloss and not down here in termenv. |
Yeah, I can't speak to @muesli's intent, but I believe the idea with Termenv was to keep it from performing magic automatically. That said I do think some version of the functions we're using would be a nice utility function in Termenv. |
My intent is indeed to not perform these kind of things auto-magically. I agree however that a convenient helper is better than copying this around everywhere, so I've just added it in #61. Basic flow: mode, err := termenv.EnableWindowsANSIConsole()
if err != nil {
panic(err)
}
defer termenv.RestoreWindowsConsole(mode) |
The |
I haven't tried your library on win10, so maybe you have some magic I don't know about, but I'm guessing this library works well in Windows Terminal, but not so much in cmd.com or powershell (where ANSI is disabled by default). But if I'm wrong and there's magic that makes this all work out, I'm very interested in what it is! :)
Over in gchalk, I first of all ported node.js's "supports-color" library which detects if the current Windows version supports 256 color or 16.7m color ANSI, and second I used this trick to enable ANSI color on non-Windows-Terminal terminals if it isn't enabled already. If you're interested in a PR that steals these, or which just uses
supportscolor
, I'm happy to supply one.The text was updated successfully, but these errors were encountered: