Skip to content

Conversation

@vmaerten
Copy link
Member

@vmaerten vmaerten commented Dec 12, 2025

Summary

fixes #1589

Running Task in CI often produces monochrome output, making it harder to scan logs and spot important information. This PR fixes that.

Task now automatically enables colored output when running in CI environments (CI=true). This matches the behavior of popular tools like Terraform, cargo, npm, and pytest which all auto-detect CI and enable colors.

Before

task: [build] go build -o ./bin/task ./cmd/task
task: [test] go test ./...
task: Failed to run task "test": exit status 1

Plain text wall - errors blend in with everything else.

After

Colored output with visual hierarchy - task names in green, errors in red, making logs scannable at a glance.

Why this matters

  • Improved readability - Colors help distinguish task names, commands, and errors
  • Industry standard - Tools like Terraform, cargo, npm already do this
  • GitHub Actions supports ANSI colors - No reason not to use them
  • Zero configuration - Just works, respects NO_COLOR if needed

Changes

  • Auto-detect CI via CI=true environment variable
  • Add color option to .taskrc.yml for global configuration
  • Respect priority: CLI flag > taskrc > NO_COLOR > FORCE_COLOR > CI > TTY default
  • Update documentation and JSON schema

Test plan

  • CI=true task --list shows colored output
  • NO_COLOR=1 CI=true task --list has no colors (NO_COLOR takes priority)
  • task --color=false disables colors even with CI=true
  • Setting color: false in ~/.taskrc.yml disables colors globally

@vmaerten vmaerten changed the title feat(flags): auto-detect color output in CI environments feat: auto-detect color output in CI environments Dec 12, 2025
@vmaerten vmaerten marked this pull request as ready for review December 12, 2025 18:33
@vmaerten vmaerten self-assigned this Dec 12, 2025
@vmaerten vmaerten added the area: formatting Changes related to output and formatting. label Dec 12, 2025
Automatically enable colored output when running in CI environments
(CI=true or GITHUB_ACTIONS=true) without requiring FORCE_COLOR=1.

Priority: CLI flag > taskrc config > NO_COLOR > FORCE_COLOR/CI > TTY default

Also adds `color` option to taskrc for global configuration.
Also simplify CI detection to only check CI=true since most CI providers
(including GitHub Actions) set this variable automatically.
@vmaerten vmaerten merged commit 6660afc into main Dec 18, 2025
13 checks passed
@vmaerten vmaerten deleted the feat/color branch December 18, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: formatting Changes related to output and formatting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can't disable color in taskfile.yml

2 participants