How to use the termcolor.RESET function in termcolor

To help you get started, we’ve selected a few termcolor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LAripping / SAPhIRE / View on Github external
        threshold_w_nonp = threshold

    print_line = ''
    if first_last:
        print_line += ' '
        for i in range(threshold_w_nonp):
            if i
github cs50 / style50 / style50 / View on Github external
def color_transition(old_type, new_type):
            new_color = termcolor.colored("", None, "on_red" if new_type ==
                                          "-" else "on_green" if new_type == "+" else None)
            return "{}{}".format(termcolor.RESET, new_color[:-len(termcolor.RESET)])
github alttch / eva3 / lib / eva / client / View on Github external
fmt_str = '\001' + fmt_str + '\002'
        fmt_str += '%s'
        if color is not None:
            text = fmt_str % (termcolor.COLORS[color], text)

        if on_color is not None:
            text = fmt_str % (termcolor.HIGHLIGHTS[on_color], text)

        if attrs is not None:
            for attr in attrs:
                text = fmt_str % (termcolor.ATTRIBUTES[attr], text)

        if rlsafe:
            text += '\001' + termcolor.RESET + '\002'
            text += termcolor.RESET
    return text
github zaufi / pluggable-output-processor / outproc / View on Github external
assert isinstance(filename, pathlib.Path)

        # Remember filename for future references (to show errors)
        self.filename = filename
        # Make an empty dict for configuration data = {}

        # Set some predefined values
        # TODO Replace w/ `enum`
        class dummy:
        self.color = dummy
        setattr(self.color, 'normal', '\x1b[38m')
        setattr(self.color, 'normal_bg', '\x1b[48m')
        setattr(self.color, 'reset', termcolor.RESET)

        # NOTE Konsole terminal from KDE supports itallic font style
        termcolor.ATTRIBUTES['itallic'] = 3

        if not filename.exists():

        # Read the file line by line, and collect keys and values into an internal dict
        # TODO Use configparser
        with as ifs:
            for l in ifs.readlines():
                # Strip possible comment lines
                line_str = l.strip()
                if not line_str or line_str.startswith('#'):
                # Split by first '=' char