Add a function to force color in console output (#1724)
Add a function `ForceConsoleColor`, like `DisableConsoleColor` but to force coloring the output. It usefull when some IDE's integrated console (like IntelliJ or Goland) are not detected as TTY, but can display colors. Also helps if one want to output color in log file (#1590) and as a workaround for #1547.
This commit is contained in:
committed by
Bo-Yi Wu
parent
90587c7787
commit
a58a2f9bf3
@ -340,3 +340,10 @@ func TestDisableConsoleColor(t *testing.T) {
|
||||
DisableConsoleColor()
|
||||
assert.True(t, disableColor)
|
||||
}
|
||||
|
||||
func TestForceConsoleColor(t *testing.T) {
|
||||
New()
|
||||
assert.False(t, forceColor)
|
||||
ForceConsoleColor()
|
||||
assert.True(t, forceColor)
|
||||
}
|
||||
|
Reference in New Issue
Block a user