Earlier quoted context omitted.
I have a similar setup, and it is relatively easy to set up using .bashrc and terminal color variables.
I did something similar with a shell script for MySQL databases, both to support shorthand invocation (i.e. "mysql foo-bar-baz" to look up the named configuration, expand it into whatever set of arguments is defined therein, and invoke mysql(1) accordingly), and to allow for detailed and environment-specific prompts which warn me when I'm targeting production. It's hideous, of course. But it works very well for me, a…
https://gist.github.com/anonymous/8ec128e88dac85d93ed58fb518...
Outside GNU coreutils, the only dependencies are mysql(1) (of course) and jq(1), which is more or less "awk for JSON" and which I strongly recommend to anyone who regularly deals with that file format.
Share and Enjoy!