I have finally been able to get an answer to this question that does exactly what I expect it to.
For those interested the details; see the man terminfo
and man termcap
man pages. Those man pages layout terminal capabilities and environment variables that you can set allowing you to customize colors for any commands output.
One such example is having colored man pages:
man() {
env LESS_TERMCAP_mb=$'\E[01;31m' \
LESS_TERMCAP_md=$'\E[01;38;5;202m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[0;1;4;38;5;82m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;38;5;51m' \
man "$@"
}
The above variables will get applied to the environment of man
when it's executed giving colors within a man
page. These can also be applied to other commands (assuming it's using the terminfo
output fields properly).