Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Specifically, on OSX, in zsh.

I'd like it when say...

man man

The background color is a darkish-yellow and the foreground is a charcoal gray/black. In this way I'm sure I'm looking at a man page and not some output.

I've tried to echo some escape codes before the command...

echo -e "\e[31m\e[43m"; man man

But I didn't get the desired effect, the background color "sort of" changed, but I get the impression man itself is producing escape codes that are canceling out mine.

I also tried digging around in the man.conf groff and grotty configuration but I didn't find anything, but that doesn't mean it isn't there.

I also thought maybe I could create a custom tty or something and export that but it's not clear to me how that would work either.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You could make use of LESS_TERMCAP_*s with a function like:

man() {
    env \
    LESS_TERMCAP_mb=$(printf "\e[1;31m") \
    LESS_TERMCAP_md=$(printf "\e[1;31m") \
    LESS_TERMCAP_me=$(printf "\e[0m") \
    LESS_TERMCAP_se=$(printf "\e[0m") \
    LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
    LESS_TERMCAP_ue=$(printf "\e[0m") \
    LESS_TERMCAP_us=$(printf "\e[1;32m") \
    man "$@"
}

The above is what I use, and have sourced in my bashrc.

You can read through termcap(5) for more info, but I think se and so may be the ones you want to set.

share|improve this answer
    
I found the red way to harsh, so I adjusted for blue+white gist.github.com/reklis/6250044 –  slf Aug 16 '13 at 13:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.