Without understanding the minutiae of this, couldn’t someone just write a program that we can pipe any output to, which strips colour commands from its input before writing it back out? Does such a program already exist? That wouldn’t require every program to add support for an environment variable.

Great question!

There is ansi2txt (packaged as colorized-logs on debian).

https://github.com/kilobyte/colorized-logs

I also found some answers on SO with people using a sed command for this.

https://stackoverflow.com/questions/17998978/removing-colors...