_colorForCode: added switch statement over enum ColorMode
PTYTextView:colorFromRGB -> PTYTextView:colorFromRed
minor cleanup for style and safety
Merge a few more fixes from branch '24-bit-color' into 18-bit-color