I just installed the colored-man-pages zsh plugin.

It works well, but I have an ugly color output on the bottom message:

enter image description here

What is the proper way to personalize the color of the plugins without overwriting everything? It seems the color are set up directly during the plugin activation.

Or maybe it's a bug with my system, fixable with an another way? Indeed, it looks weird to have this default unreadable color output.

I run under Ubuntu 18.10 and gnome-terminal.

2 Answers 2


The format of man pages (groff) doesn't allow colors explicitly, but utilizes a few text decorations like bold or underlines, which in turn can be re-interpreted by a viewer to show colors. And this is exactly what linked plugin is doing, so I suggest to remove this plugin and instead set the colors directly in .zshrc via LESS_TERMCAP variables (I assume you are using less as you man pager and so does this plugin).

Here is the list of variables with description:

export LESS_TERMCAP_mb=$'\e[6m'          # begin blinking
export LESS_TERMCAP_md=$'\e[34m'         # begin bold
export LESS_TERMCAP_us=$'\e[4;32m'       # begin underline
export LESS_TERMCAP_so=$'\e[1;33;41m'    # begin standout-mode - info box
export LESS_TERMCAP_me=$'\e[m'           # end mode
export LESS_TERMCAP_ue=$'\e[m'           # end underline
export LESS_TERMCAP_se=$'\e[m'           # end standout-mode

The list of color codes can be found with this script:


echo "PALETTE OF 8 COLORS (bold, high intensity, normal, faint)"
for i in {30..37}; do printf "\e[1;${i}m1;%-2s      \e[m" "$i"; done; echo
for i in {90..97}; do printf "\e[${i}m%+4s      \e[m" "$i"; done; echo
for i in {30..37}; do printf "\e[${i}m%+4s      \e[m" "$i"; done; echo
for i in {30..37}; do printf "\e[2;${i}m2;%-2s      \e[m" "$i"; done;

echo -e "\n\n\nPALETTE OF 256 COLORS (only normal)"
for i in {0..255}; do
    [[ $i = 16 ]] && j=6
    [[ $i = 232 ]] && j=8
    printf "\e[38;5;${i}m38;5;%-4s\e[m" "${i}"
    (( i>15 && i<232 )) && printf "\e[52C\e[1;38;5;${i}m1;38;5;%-4s\e[52C\e[m\e[2;38;5;${i}m2;38;5;%-4s\e[m\e[126D" "${i}" "${i}"
    [[ $(( $(( $i - 15 )) % $j )) = 0 ]] && echo
    [[ $(( $(( $i - 15 )) % $(( $j * 6 )) )) = 0 ]] && echo
exit 0
  • Well, I would prefer a way to not override all the default colors settings, but it's not a painful thing after all. Thanks for the detailed explanation by the way, I appreciate it. :-) If no less intrusive option is proposed, I'll select it as best answer. Feb 17, 2019 at 14:26
  • 1
    @Soullivaneuh there is no other way to set colors than that and linked plugin does exactly the same (see its source) + some extra nroff stuff for solaris. BTW, your 'ugly' blue line comes from LESS_TERMCAP_so variable, so perhaps for you it is enough to change only this one.
    – jimmij
    Feb 17, 2019 at 14:44
  • Which variable would be matching for highlight color for when I search a word in man?
    – alper
    Jun 3, 2020 at 0:38
  • @alper Also LESS_TERMCAP_so.
    – jimmij
    Jun 3, 2020 at 15:59
  • I was able to come up with coloring by trial and error for the \e[1;33;41m'
    – alper
    Jun 3, 2020 at 17:41

The given solution is quite elegant. I wish the official Oh My ZSH wiki ohmyzsh/plugins/colored-man-pages/ where there is no list of colors or of the items in the array less_termcap. Here is the content of ##Customization with just one small example:

The plugin declares global associative array less_termcap, which maps termcap capabilities to escape sequences for the less pager. This mapping can be further customized by the user after the plugin is loaded. Check out sources for more.

For example: less_termcap[md] maps to LESS_TERMCAP_md which is the escape sequence that tells less how to print something in bold. It's currently shown in bold red, but if you want to change it, you can redefine less_termcap[md] in your zshrc file, after OMZ is sourced:

less_termcap[md]="${fg_bold[blue]}" # this tells less to print bold text in bold blue

And I guess you could experiment more with all termcap

# mb       start blink
# md       start bold
# me       turn off bold, blink and underline
# so       start standout (reverse video)
# se       stop standout
# us       start underline
# ue       stop underline


But if you actually don't want spending time by trial and error, that one line could be more than enough


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .