jeaye / stdman

Formatted C++20 stdlib man pages (cppreference)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Colorized output

ShPavel opened this issue · comments

I expected it to be in color, like in your preview )
A short instruction or a link in the README how to make output colorized would be helpful.

For Ubuntu:

sudo apt-get install most
echo 'export MANPAGER="most"' >> ~/.bashrc && source ~/.bashrc

most is missing some features that make it ideal for (my) use, but it does have the one redeeming feature of interpreting raw character codes out of the box. Instead, I use less, which is better documented and works more like vim. To get colored output in less for man pages, I have this in my ~/.bashrc.

# Colors
default=$(tput sgr0)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 39)
purple=$(tput setaf 5)
cyan=$(tput setaf 6)
orange=$(tput setaf 9)
white=$(tput setaf 7)

# Less colors for man pages
export PAGER=less
# Begin blinking
export LESS_TERMCAP_mb=$red
# Begin bold
export LESS_TERMCAP_md=$orange
# End mode
export LESS_TERMCAP_me=$default
# End standout-mode
export LESS_TERMCAP_se=$default
# Begin standout-mode - info box
export LESS_TERMCAP_so=$purple
# End underline
export LESS_TERMCAP_ue=$default
# Begin underline
export LESS_TERMCAP_us=$green

I would not be opposed to adding some helpful documentation on how to set these up though. Thanks for the issue.