Skip to content

Commit 8eb2f66

Browse files
committed
Address feedback from pellared:
- NO_COLOR env is respected in color_windows.go - fixes indent
1 parent d080a5b commit 8eb2f66

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

color_windows.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ func init() {
1111
// https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#output-sequences
1212
var outMode uint32
1313
out := windows.Handle(os.Stdout.Fd())
14-
if err := windows.GetConsoleMode(out, &outMode); err == nil {
15-
outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
16-
_ = windows.SetConsoleMode(out, outMode)
14+
if err := windows.GetConsoleMode(out, &outMode); err == nil || NoColor {
15+
return
1716
}
17+
18+
outMode |= windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
19+
_ = windows.SetConsoleMode(out, outMode)
1820
}

0 commit comments

Comments
 (0)