1

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

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 view 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:

#!/bin/bash

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)"
j=8
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
done
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. – Soullivaneuh Feb 17 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 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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