Skip to content

Support the FORCE_COLOR emerging standard in ConsoleUtils.EmitAnsiColorCodes #124091

@baronfel

Description

@baronfel

dotnet watch is likely spawning child processes with input/output streams redirected - many of our CLI outputs across .NET use 'is the output redirected' as a heuristic for 'am I allowed to output ANSI/VT control codes'. This check is not robust enough to support cases like watch.

There's an emerging standard env var called FORCE_COLOR that could be used here - the biggest CLI libraries and many popular apps support its use. If the .NET console loggers supported this, then watch could provide this variable and color-based experiences (though not interactive-based experiences) could be preserved.

Originally posted by @baronfel in #52864

We already support NO_COLOR for disablement, but it would be great if we also supported this flag for forcing the use of colorized outputs.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions