From f878506b30a20e7b6c29cd17d93217f5ebd80b0b Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Thu, 21 Apr 2022 22:22:49 -0400 Subject: [PATCH] Revert "Do not show colors in Windows CMD & Powershell (#138)" (#140) This reverts commit 8c5f2aa275eae7938d898cde4a33bb58a4fa7849. --- spinner.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/spinner.go b/spinner.go index 63b655e..57ff8b3 100644 --- a/spinner.go +++ b/spinner.go @@ -100,8 +100,7 @@ var validColors = map[string]bool{ } // returns true if the OS is windows and the WT_SESSION env variable is set. -var isWindows = runtime.OSOS == "windows" -var isWindowsTerminalOnWindows = len(os.Getenv("WT_SESSION")) > 0 && isWindows +var isWindowsTerminalOnWindows = len(os.Getenv("WT_SESSION")) > 0 && runtime.GOOS == "windows" // returns a valid color's foreground text color attribute var colorAttributeMap = map[string]color.Attribute{ @@ -282,12 +281,6 @@ func (s *Spinner) Start() { // hides the cursor fmt.Fprint(s.Writer, "\033[?25l") } - // Disable colors for simple Windows CMD or Powershell - // as they can not recognize them - if isWindows && !isWindowsTerminalOnWindows { - color.NoColor = true - } - s.active = true s.mu.Unlock() @@ -312,7 +305,7 @@ func (s *Spinner) Start() { } var outColor string - if isWindows { + if runtime.GOOS == "windows" { if s.Writer == os.Stderr { outColor = fmt.Sprintf("\r%s%s%s", s.Prefix, s.chars[i], s.Suffix) } else {