dotfiles/bin/colorman

40 lines
922 B
Bash
Executable file

#!/bin/sh
# Colorized man pages
Reset=$(tput sgr0)
Base03=8
Base02=0
#Base01=10
#Base00=11
#Base0=12
#Base1=14
#Base2=7
Base3=15
#Red=1
#Orange=9
Yellow=3
#Green=2
Cyan=6
Blue=4
#Violet=13
#Magenta=5
if [ "$BACKGROUND" = "light" ]; then
standout=$( printf '%s\n' "setaf $Base3" "setab $Cyan" | tput -S)
bold=$( printf '%s\n' "setaf $Blue" | tput -S)
underline=$(printf '%s\n' "setaf $Base02" "smul" | tput -S)
else
standout=$( printf '%s\n' "setaf $Base03" "setab $Cyan" | tput -S)
bold=$( printf '%s\n' "setaf $Yellow" | tput -S)
underline=$(printf '%s\n' "setaf $Base3" "smul" | tput -S)
fi
LESS_TERMCAP_so="$standout" \
LESS_TERMCAP_md="$bold" \
LESS_TERMCAP_us="$underline" \
LESS_TERMCAP_se="$Reset" \
LESS_TERMCAP_me="$Reset" \
LESS_TERMCAP_ue="$Reset" \
GROFF_NO_SGR=1 \
man "$@"