This only helps if the program that pipes into less doesn't do terminal detection to decide that it doesn't want to output ANSI color escapes into a pipe (to less).
ls --color=auto | less -R
we'd see no color. Instead we can run ls under expect: expect -c "spawn -noecho ls --color=auto; expect" | less -R
and color abounds.There may be an easier way to accomplish this. If anybody has ideas, chime in.
Thanks a bunch for pointing me towards `expect`, though! I hadn't used it before, and I'll definitely do some experimenting with it to see if I can get my desired output with it.