# Source file to set colorization in less and man # To change between ansi escape and tput, change commenting as required # # Change the variable below to specify the colorization method to use # Valid values are "ansi" and "tput" COLORIZER="tput" # Set pagers and turn off select graphic rendition (SGR) export GROFF_NO_SGR=1 export MANPAGER='less' export PAGER='less' # Check the COLORIZER variable to use the requested method if [[ "$COLORIER" == "ansi" ]]; then # Set ansi escape codes to colorize less/man output export LESS_TERMCAP_mb=$'\e[1;31m' # blinking text mode (if supported), set to bold/red export LESS_TERMCAP_md=$'\e[1;31m' # bold text mode, set to bold/red export LESS_TERMCAP_me=$'\e[0m' # ends all special formatting (like mb, md, etc.) export LESS_TERMCAP_se=$'\e[0m' # ends standout mode export LESS_TERMCAP_so=$'\e[1;33;44m' # begin standout mode, bold/yellow text w/ blue background export LESS_TERMCAP_ue=$'\e[0m' # end underline mode export LESS_TERMCAP_us=$'\e[4;1;32m' # begin underline mode, bold/green text w/ underline export LESS_TERMCAP_mr=$'\e[7m' # begin reverse video mode export LESS_TERMCAP_mh=$'\e[2m' # begin dim, half bright mode export LESS_TERMCAP_ZN=$'\e[74m' # begin subscript mode, possibly not supported export LESS_TERMCAP_ZV=$'\e[75m' # end subscript mode, possibly not supported export LESS_TERMCAP_ZO=$'\e[73m' # begin superscript mode, possibly not supported export LESS_TERMCAP_ZW=$'\e[75m' # end superscript mode, possible not supported elif [[ "$COLORIZER" == "tput" ]]; then # Set tput values to match the same colors above (see line comments above for descriptions) export LESS_TERMCAP_md=$(tput bold; tput setaf 1) export LESS_TERMCAP_me=$(tput sgr0) export LESS_TERMCAP_se=$(tput sgr0) export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4) export LESS_TERMCAP_ue=$(tput sgr0) export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 2) export LESS_TERMCAP_mr=$(tput rev) export LESS_TERMCAP_mh=$(tput dim) export LESS_TERMCAP_ZN=$(tput ssubm) export LESS_TERMCAP_ZV=$(tput rsubm) export LESS_TERMCAP_ZO=$(tput ssupm) export LESS_TERMCAP_ZW=$(tput rsupm) else echo echo ***** COLORIZER variable must be set to colorize man/less output ***** echo fi