Skip to content

Commit f878506

Browse files
authored
Revert "Do not show colors in Windows CMD & Powershell (#138)" (#140)
This reverts commit 8c5f2aa.
1 parent 8c5f2aa commit f878506

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

spinner.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ var validColors = map[string]bool{
100100
}
101101

102102
// returns true if the OS is windows and the WT_SESSION env variable is set.
103-
var isWindows = runtime.OSOS == "windows"
104-
var isWindowsTerminalOnWindows = len(os.Getenv("WT_SESSION")) > 0 && isWindows
103+
var isWindowsTerminalOnWindows = len(os.Getenv("WT_SESSION")) > 0 && runtime.GOOS == "windows"
105104

106105
// returns a valid color's foreground text color attribute
107106
var colorAttributeMap = map[string]color.Attribute{
@@ -282,12 +281,6 @@ func (s *Spinner) Start() {
282281
// hides the cursor
283282
fmt.Fprint(s.Writer, "\033[?25l")
284283
}
285-
// Disable colors for simple Windows CMD or Powershell
286-
// as they can not recognize them
287-
if isWindows && !isWindowsTerminalOnWindows {
288-
color.NoColor = true
289-
}
290-
291284
s.active = true
292285
s.mu.Unlock()
293286

@@ -312,7 +305,7 @@ func (s *Spinner) Start() {
312305
}
313306

314307
var outColor string
315-
if isWindows {
308+
if runtime.GOOS == "windows" {
316309
if s.Writer == os.Stderr {
317310
outColor = fmt.Sprintf("\r%s%s%s", s.Prefix, s.chars[i], s.Suffix)
318311
} else {

0 commit comments

Comments
 (0)