How to use the carto.color.Color function in carto

To help you get started, we’ve selected a few carto 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 CartoDB / carto-python / carto / color.py View on Github external
def enable_colors(mode):
    Color.enabled = mode
github CartoDB / carto-python / carto / color.py View on Github external
def colored(attrib, text):
    if not Color.enabled:
        return text
    if type(attrib) != list:
        attrib = [attrib]
    attrib = ''.join([Color.COLORS[a] for a in attrib])
    return attrib + str(text) + Color.END
github CartoDB / carto-python / carto / color.py View on Github external
def colored(attrib, text):
    if not Color.enabled:
        return text
    if type(attrib) != list:
        attrib = [attrib]
    attrib = ''.join([Color.COLORS[a] for a in attrib])
    return attrib + str(text) + Color.END
github CartoDB / carto-python / carto / analysis.py View on Github external
def _color_logs(logs):
    if logs and Color.enabled:
        logs = re.sub(r'^EVENTS$', Color.COLORS['blue'], logs, flags=re.MULTILINE)
        logs = re.sub(r'^STDOUT$', Color.END + Color.COLORS['yellow'], logs, flags=re.MULTILINE)
        logs = re.sub(r'^STDERR$', Color.END + Color.COLORS['red'], logs, flags=re.MULTILINE)
        logs = logs + Color.END
    return logs
github CartoDB / carto-python / carto / analysis.py View on Github external
def _color_logs(logs):
    if logs and Color.enabled:
        logs = re.sub(r'^EVENTS$', Color.COLORS['blue'], logs, flags=re.MULTILINE)
        logs = re.sub(r'^STDOUT$', Color.END + Color.COLORS['yellow'], logs, flags=re.MULTILINE)
        logs = re.sub(r'^STDERR$', Color.END + Color.COLORS['red'], logs, flags=re.MULTILINE)
        logs = logs + Color.END
    return logs