1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

Add FORCE_COLOR env support (#1003)

This commit is contained in:
Aleksandr Komlev
2023-02-17 03:12:44 +03:00
committed by GitHub
parent c8fe450623
commit 9af056e746
3 changed files with 6 additions and 0 deletions

View File

@@ -34,6 +34,10 @@ func Red() PrintFunc {
}
func envColor(env string, defaultColor color.Attribute) color.Attribute {
if os.Getenv("FORCE_COLOR") != "" {
color.NoColor = false
}
override, err := strconv.Atoi(os.Getenv(env))
if err == nil {
return color.Attribute(override)