src/lsi/utils/term.py
def color(number):
    """
    Returns a function that colors a string with a number from 0 to 255.
    """
    if supports_256():
        template = "\033[38;5;{number}m{text}\033[0m"
    else:
        template = "\033[{number}m{text}\033[0m"
    def _color(text):
        if not all([sys.stdout.isatty(), sys.stderr.isatty()]):
            return text
        else:
            return template.format(number=number, text=text)
    return _color
def color(number):
    if supports_256():
        template = "\033[38;5;{number}m{text}\033[0m"
    else:
        template = "\033[{number}m{text}\033[0m"
    def _color(text):
        if not all([sys.stdout.isatty(), sys.stderr.isatty()]):
            return text
        else:
            return template.format(number=number, text=text)
    return _color
def color ( number ) : if supports_256 ( ) : template = "\033[38;5;{number}m{text}\033[0m" else : template = "\033[{number}m{text}\033[0m" def _color ( text ) : if not all ( [ sys . stdout . isatty ( ) , sys . stderr . isatty ( ) ] ) : return text else : return template . format ( number = number , text = text ) return _color
Returns a function that colors a string with a number from 0 to 255.
Returns a function that colors a string with a number from 0 to 255 .