diff --git a/text_formatter.go b/text_formatter.go index ed578d2..acb0dc0 100644 --- a/text_formatter.go +++ b/text_formatter.go @@ -91,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" { @@ -103,7 +103,7 @@ func (f *TextFormatter) isColored() bool { } } - return isColored && !f.DisableColors && (runtime.GOOS != "windows") + return isColored && !f.DisableColors } // Format renders a single log entry diff --git a/text_formatter_test.go b/text_formatter_test.go index 8dfec5a..5b13237 100644 --- a/text_formatter_test.go +++ b/text_formatter_test.go @@ -444,7 +444,7 @@ func TestTextFormatterIsColored(t *testing.T) { os.Setenv("CLICOLOR_FORCE", val.clicolorForceVal) } res := tf.isColored() - if runtime.GOOS == "windows" { + if runtime.GOOS == "windows" && !tf.ForceColors && !val.clicolorForceIsSet { assert.Equal(subT, false, res) } else { assert.Equal(subT, val.expectedResult, res)