How to use the termcolor.COLORS.keys 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 black-security / cyber-security-framework / core / modules / View on Github external
def print(*messages, color: str = "white", dark: bool = False, prefix: str = "", parse: bool = True, **kwargs):
    if "file" not in kwargs:
        kwargs["file"] = stdout
    columns = os.get_terminal_size().columns
    #except ValueError:
    #    columns = None
    string = ""
    for message in messages:
        if isinstance(message, (tuple, list, set)):
            if isinstance(message[-1], bool):
                *message, dark = message
            if message[-1] in termcolor.COLORS.keys():
                *message, color = message
            message = " ".join(map(str, message))
        string += termcolor.colored(message, color, attrs=["dark"] if dark else [])
    #if columns:
    _print((fit(string, prefix) if parse else string), **kwargs)
github eegsynth / eegsynth / lib / View on Github external
def __init__(self, name=None): = name
        colors = list(termcolor.COLORS.keys()) # prevent RuntimeError: dictionary changed size during iteration
        # add reverse and bright color
        for color in colors:
            termcolor.COLORS['reverse_'+color] = termcolor.COLORS[color]+10
            termcolor.COLORS['bright_'+color] = termcolor.COLORS[color]+60
        # for color in termcolor.COLORS.keys():