Skip to content

Commit

Permalink
Address feedback from pellared:
Browse files Browse the repository at this point in the history
- NO_COLOR env is respected in color_windows.go
- fixes indent
  • Loading branch information
martinlindhe committed Mar 1, 2023
1 parent d080a5b commit 8eb2f66
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions color_windows.go
Expand Up @@ -11,8 +11,10 @@ func init() {
// https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#output-sequences
var outMode uint32
out := windows.Handle(os.Stdout.Fd())
if err := windows.GetConsoleMode(out, &outMode); err == nil {
outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
_ = windows.SetConsoleMode(out, outMode)
if err := windows.GetConsoleMode(out, &outMode); err == nil || NoColor {
return
}

outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
_ = windows.SetConsoleMode(out, outMode)
}

0 comments on commit 8eb2f66

Please sign in to comment.