> That's a pretty niche case
I don't entirely agree. When I do want colour (generally because I've taken the time to configure the program suitably for it), then I usually still want the colour when I pipe its output through a pager. `diff` is the canonical example.
Edit: Another comment¹ points out pipetty² as a workaround, so I learned something useful today.
Check out lesstty from https://github.com/kilobyte/colorized-logs.
(Or https://github.com/jwilk/pagerboy, which supports pagers other than less.)
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...