How to use the colored.fore function in colored

To help you get started, we’ve selected a few colored 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 chriskiehl / Gooey / gooey / gui / components / widgets / richtextconsole.py View on Github external
self.url_colour = wx.Colour(0,0,255)
        self.esc = colored.style.ESC
        self.end = colored.style.END
        self.noop = lambda *args, **kwargs: None

        self.actionsMap = {
            colored.style.BOLD: self.BeginBold,
            colored.style.RES_BOLD: self.EndBold,
            colored.style.UNDERLINED: self.BeginUnderline,
            colored.style.RES_UNDERLINED: self.EndUnderline,
            colored.style.RESET: self.EndAllStyles,
        }

        # Actions for coloring text
        for index, hex in enumerate(kColorList):
            escSeq = '{}{}{}'.format(colored.fore.ESC, index, colored.fore.END)
            wxcolor = wx.Colour(int(hex[1:3],16), int(hex[3:5],16), int(hex[5:],16), alpha=wx.ALPHA_OPAQUE)
            # NB : we use a default parameter to force the evaluation of the binding
            self.actionsMap[escSeq] = lambda bindedColor=wxcolor: self.BeginTextColour(bindedColor)
github merenlab / anvio / anvio / terminal.py View on Github external
c += ' ' * surpass

        c += eta_c

        if self.verbose:
            if self.progress_total_items and self.is_tty:
                p_text = ''
                p_length = self.LEN(p_text)

                end_point = self.LEN(c) - self.LEN(eta_c)
                break_point = round(end_point * self.progress_current_item / self.progress_total_items)

                # see a full list of color codes: https://gitlab.com/dslackw/colored
                if p_length >= break_point:
                    sys.stderr.write(back.CYAN + fore.BLACK + c[:break_point] + \
                                     back.GREY_30 + fore.WHITE + c[break_point:end_point] + \
                                     back.CYAN + fore.CYAN + c[end_point] + \
                                     back.GREY_50 + fore.LIGHT_CYAN + c[end_point:] + \
                                     style.RESET)
                else:
                    sys.stderr.write(back.CYAN + fore.BLACK + c[:break_point - p_length] + \
                                     back.SALMON_1 + fore.BLACK + p_text + \
                                     back.GREY_30 + fore.WHITE + c[break_point:end_point] + \
                                     back.GREY_50 + fore.LIGHT_CYAN + c[end_point:] + \
                                     style.RESET)
                sys.stderr.flush()
            else:
                sys.stderr.write(back.CYAN + fore.BLACK + c + style.RESET)
                sys.stderr.flush()
github nmstoker / lockebot / basebot.py View on Github external
# -----------------------

CHANNEL_IN = 'screen'  # 'email' OR 'screen' OR 'online'
CHANNELS_OUT = {'email': False, 'online': False, 'screen': True}

STY_DESC = fore.LIGHT_GREEN + back.BLACK
STY_DESC_DEBUG = fore.SKY_BLUE_1 + back.BLACK + style.DIM
STY_HELP = fore.DARK_SLATE_GRAY_3 + back.BLACK
STY_HIDDEN = fore.BLACK + back.BLACK
STY_USER = style.RESET + fore.WHITE + back.BLACK
STY_CURSOR = fore.LIGHT_GOLDENROD_2B + back.BLACK + style.BOLD
STY_RESP = fore.WHITE + back.MEDIUM_VIOLET_RED + style.BOLD
# STY_RESP = fore.WHITE + back.GREY_11 + style.BOLD #+ style.NORMAL
STY_EMAIL = fore.WHITE + back.GREY_11 + style.BOLD
STY_RESP_SPECIAL = fore.WHITE + back.LIGHT_GOLDENROD_2B + style.BOLD
STY_HIGHLIGHT = fore.DEEP_PINK_4C + back.BLACK
STY_DRAW = fore.WHITE + back.BLACK + style.BOLD

logger = logging.getLogger(BOTNAME)
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.WARN)
# ch.setLevel(logging.DEBUG)
formatter = logging.Formatter(
    STY_DESC_DEBUG + '%(asctime)s - %(name)s - %(levelname)8s - %(message)s' +
    style.RESET, datefmt='%Y-%b-%d %H:%M:%S')
ch.setFormatter(formatter)
logger.addHandler(ch)

numwords = {}