ansi_windows.go 485 B

12345678910111213141516171819202122
  1. //go:build windows
  2. // +build windows
  3. package lipgloss
  4. import (
  5. "sync"
  6. "github.com/muesli/termenv"
  7. )
  8. var enableANSI sync.Once
  9. // enableANSIColors enables support for ANSI color sequences in the Windows
  10. // default console (cmd.exe and the PowerShell application). Note that this
  11. // only works with Windows 10. Also note that Windows Terminal supports colors
  12. // by default.
  13. func enableLegacyWindowsANSI() {
  14. enableANSI.Do(func() {
  15. _, _ = termenv.EnableWindowsANSIConsole()
  16. })
  17. }