Use 'less -r' to display ANSI color in less.
Crazy idea - what if other utilites were aware of ANSI codes and behaved appropriately? For example 'grep' could ignore color sequences when doing pattern-matching, and then re-apply the colors to the output. Then you could do something like `git log | grep` and see the original coloration in the output.
Re:Disabling ANSI color output
by dragonwriter on Wednesday February 07, 2018 @05:57PM
(#16328740)
> Crazy idea - what if other utilites were aware of ANSI codes and behaved appropriately?
If ANSI sequences were only color, they might be feasible; getting a clear idea on what “appropriately” means for general ANSI content in a text stream is... difficult.
I'd be happy with just the Graphic parameters https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_G...
Re:Disabling ANSI color output
by thisacctforreal on Wednesday February 07, 2018 @05:03AM
(#16323395)
I wonder if tmux or iTerm2 could have an option to not autoscroll the command off the screen.
Technically terminals can play the interactive role in place of “less”: ^S/^Q, scrollback and search, etc. If that were more common, programs might not be misusing color/style sequences like this (as there wouldn’t be a common “interactive pipe” use case to support).