diff --git a/text_formatter.go b/text_formatter.go index 17f0004..fb21649 100644 --- a/text_formatter.go +++ b/text_formatter.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "os" + "runtime" "sort" "strings" "sync" @@ -90,7 +91,7 @@ func (f *TextFormatter) init(entry *Entry) { } func (f *TextFormatter) isColored() bool { - isColored := f.ForceColors || f.isTerminal + isColored := f.ForceColors || (f.isTerminal && (runtime.GOOS != "windows")) if f.EnvironmentOverrideColors { if force, ok := os.LookupEnv("CLICOLOR_FORCE"); ok && force != "0" { diff --git a/text_formatter_test.go b/text_formatter_test.go index e07809d..9c5e6f0 100644 --- a/text_formatter_test.go +++ b/text_formatter_test.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "os" + "runtime" "sort" "strings" "testing" @@ -443,7 +444,11 @@ func TestTextFormatterIsColored(t *testing.T) { os.Setenv("CLICOLOR_FORCE", val.clicolorForceVal) } res := tf.isColored() - assert.Equal(subT, val.expectedResult, res) + if runtime.GOOS == "windows" && !tf.ForceColors && !val.clicolorForceIsSet { + assert.Equal(subT, false, res) + } else { + assert.Equal(subT, val.expectedResult, res) + } }) } }