def colorize(txt, fg=None, bg=None):
setting = '<STR_LIT>'<EOL>setting += _SET_FG.format(fg) if fg else '<STR_LIT>'<EOL>setting += _SET_BG.format(bg) if bg else '<STR_LIT>'<EOL>return setting + str(txt) + _STYLE_RESET<EOL>
Print escape codes to set the terminal color.

fg and bg are indices into the color palette for the foreground and
background colors.