Skip to content

Set the environment variable to enable colorful output by default #288

@Tyrrrz

Description

@Tyrrrz

Description:

.NET previously disabled console colors if it detected that the output was redirected. Recently, a new environment variable has been added to override this: dotnet/runtime#47935

Setting below environment variables will enable colorful output when running on GitHub Actions (not on Windows though):

  • DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION to 1 or true
  • TERM to xterm

More info: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables#dotnet_system_console_allow_ansi_color_redirection

Relevant discussion explaining the need for the second variable: dotnet/runtime#68302 (comment)

Justification:

Colorful output is much easier to visually parse and, since we can guarantee that we're always running on GitHub Actions (which supports ansi color escape codes), it makes sense to make this setting enabled by default. As the worst case, this should be at least added as one of the action inputs, but I think enabling it by default is the way to go (not anymore, read comments below).

Are you willing to submit a PR?

Sure

Metadata

Metadata

Assignees

Labels

feature requestNew feature or request to improve the current logic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions