def SetColor(self, foreground_color): self._Escape(AsBytes('%dm' % self.color_map[foreground_color]))
def Reset(self): self._Escape(AsBytes('0m'))
def _Escape(self, code): PushWriteBinary() try: sys.stdout.write(AsBytes('\033[') + code) finally: PopWriteBinary()