Optimize term color generation
Optimize term color generation

While the end result is the same, the method of generating the colors
slightly changed to avoid calling subshells. It does this in two ways:

1. Don't use a subshell (`$(...)`), instead call a function first, and
   use the output stored in a variable.
2. Use a cache to prevent calling to `tput` as much as possible. In this
   case, the cache doesn't do a ton, but in my tests it did give a
   slight noticeable improvement.

This on average got my prompt startup time down from 0.092s to 0.062s.
Not this specific funtion time, the whole prompt startup.

The addition of 1 on the array indexes is because some shells (ksh,
bash) are 0 array indexed, while most (zsh, csh, Bourne) are 1 array
indexed, and would then fail on this array with the black color index of
0. Adding 1 doesn't hurt anything on 0 array indexed shells.

jaesivsm/liquidprompt,tsbarnes/liquidprompt,laurentbardin/liquidprompt,milouse/liquidprompt,pkkolos/liquidprompt,nojhan/liquidprompt