Python colorama.Back.YELLOW Examples
The following are 22
code examples of colorama.Back.YELLOW().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
colorama.Back
, or try the search function
.
Example #1
Source File: personality.py From Jarvis with MIT License | 6 votes |
def __init__(self): self.Q = read_questions() self.answers = {} self.instruction = Back.YELLOW + "There are a total of " +\ "32 pairs of descriptions. For each pair, choose on a scale of " +\ "1-5. Choose 1 if you are all the way to the left, and choose " +\ "3 if you are in the middle, etc." + Style.RESET_ALL self.types = ['IE', 'SN', 'FT', 'JP'] self.scoring_scheme = ((30, (15, 23, 27), (3, 7, 11, 19, 31)), (12, (4, 8, 12, 16, 20, 32), (24, 28)), (30, (6, 10, 22), (2, 14, 18, 26, 30)), (18, (1, 5, 13, 21, 29), (9, 17, 25))) self.scores = [] self.type = []
Example #2
Source File: bmi.py From Jarvis with MIT License | 6 votes |
def print_body_state(self, jarvis, bmi): """ According the bmi number, print_body_state finds out the state of the body and prints it to the user using colorama library for some coloring """ print("BMI:", str(bmi)) if bmi < 16: print(Back.RED, " " * 2, Style.RESET_ALL) jarvis.say('Severe thinness') elif bmi < 18.5: print(Back.YELLOW, " " * 2, Style.RESET_ALL) jarvis.say('Mild thinness') elif bmi < 25: print(Back.GREEN, " " * 2, Style.RESET_ALL) jarvis.say('Healthy') elif bmi < 30: print(Back.YELLOW, " " * 2, Style.RESET_ALL) jarvis.say('Pre-obese') else: print(Back.RED, " " * 2, Style.RESET_ALL) jarvis.say('Obese')
Example #3
Source File: munin-host.py From munin with Apache License 2.0 | 6 votes |
def print_highlighted(line, hl_color=Back.WHITE): """ Print a highlighted line """ try: # Highlight positives colorer = re.compile(r'([^\s]+) POSITIVES: ([1-9]) ') line = colorer.sub(Fore.YELLOW + r'\1 ' + 'POSITIVES: ' + Fore.YELLOW + r'\2 ' + Style.RESET_ALL, line) colorer = re.compile(r'([^\s]+) POSITIVES: ([0-9]+) ') line = colorer.sub(Fore.RED + r'\1 ' + 'POSITIVES: ' + Fore.RED + r'\2 ' + Style.RESET_ALL, line) # Keyword highlight colorer = re.compile(r'([A-Z_]{2,}:)\s', re.VERBOSE) line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line) print(line) except Exception as e: pass
Example #4
Source File: munin_stdout.py From munin with Apache License 2.0 | 6 votes |
def printHighlighted(line, hl_color=Back.WHITE, tag_color=False): """ Print a highlighted line """ if tag_color: # Tags colorer = re.compile('(HARMLESS|SIGNED|MS_SOFTWARE_CATALOGUE|MSSOFT|SUCCESSFULLY\sCOMMENTED)', re.VERBOSE) line = colorer.sub(Fore.BLACK + Back.GREEN + r'\1' + Style.RESET_ALL + '', line) colorer = re.compile('(REVOKED|EXPLOIT|CVE-[0-9\-]+|OBFUSCATED|RUN\-FILE)', re.VERBOSE) line = colorer.sub(Fore.BLACK + Back.RED + r'\1' + Style.RESET_ALL + '', line) colorer = re.compile('(EXPIRED|VIA\-TOR|OLE\-EMBEDDED|RTF|ATTACHMENT|ASPACK|UPX|AUTO\-OPEN|MACROS)', re.VERBOSE) line = colorer.sub(Fore.BLACK + Back.YELLOW + r'\1' + Style.RESET_ALL + '', line) # Extras colorer = re.compile('(\[!\])', re.VERBOSE) line = colorer.sub(Fore.BLACK + Back.LIGHTMAGENTA_EX + r'\1' + Style.RESET_ALL + '', line) # Add line breaks colorer = re.compile('(ORIGNAME:)', re.VERBOSE) line = colorer.sub(r'\n\1', line) # Standard colorer = re.compile('([A-Z_]{2,}:)\s', re.VERBOSE) line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line) print(line)
Example #5
Source File: colors.py From chepy with GNU General Public License v3.0 | 6 votes |
def yellow(s: str) -> str: # pragma: no cover """Yellow color string if tty Args: s (str): String to color Returns: str: Colored string Examples: >>> from chepy.modules.internal.colors import yellow >>> print(YELLOW("some string")) """ if sys.stdout.isatty(): return Fore.YELLOW + s + Fore.RESET else: return s
Example #6
Source File: vt-checker.py From Loki with GNU General Public License v3.0 | 6 votes |
def print_highlighted(line, hl_color=Back.WHITE): """ Print a highlighted line """ # Tags colorer = re.compile('(HARMLESS|SIGNED|MS_SOFTWARE_CATALOGUE)', re.VERBOSE) line = colorer.sub(Fore.BLACK + Back.GREEN + r'\1' + Style.RESET_ALL + ' ', line) colorer = re.compile('(SIG_REVOKED)', re.VERBOSE) line = colorer.sub(Fore.BLACK + Back.RED + r'\1' + Style.RESET_ALL + ' ', line) colorer = re.compile('(SIG_EXPIRED)', re.VERBOSE) line = colorer.sub(Fore.BLACK + Back.YELLOW + r'\1' + Style.RESET_ALL + ' ', line) # Extras colorer = re.compile('(\[!\])', re.VERBOSE) line = colorer.sub(Fore.BLACK + Back.CYAN + r'\1' + Style.RESET_ALL + ' ', line) # Standard colorer = re.compile('([A-Z_]{2,}:)\s', re.VERBOSE) line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line) print line
Example #7
Source File: vt-checker-hosts.py From Loki with GNU General Public License v3.0 | 6 votes |
def print_highlighted(line, hl_color=Back.WHITE): """ Print a highlighted line """ try: # Highlight positives colorer = re.compile(r'([^\s]+) POSITIVES: ([1-9]) ') line = colorer.sub(Fore.YELLOW + r'\1 ' + 'POSITIVES: ' + Fore.YELLOW + r'\2 ' + Style.RESET_ALL, line) colorer = re.compile(r'([^\s]+) POSITIVES: ([0-9]+) ') line = colorer.sub(Fore.RED + r'\1 ' + 'POSITIVES: ' + Fore.RED + r'\2 ' + Style.RESET_ALL, line) # Keyword highlight colorer = re.compile(r'([A-Z_]{2,}:)\s', re.VERBOSE) line = colorer.sub(Fore.BLACK + hl_color + r'\1' + Style.RESET_ALL + ' ', line) print line except Exception, e: pass
Example #8
Source File: install.py From Yugioh-bot with MIT License | 5 votes |
def check_required_packages(): if SKIP_PIP_TEST: return installed_packages = pkg_resources.working_set packages = {} for package in installed_packages: packages[package.project_name] = package.version with open('requirements.txt') as f: required = list(map(lambda x: x.split('=')[0].replace('>', ''), f.read().splitlines())) required = filter(lambda x: not '#' in x, required) all_installed = True for x in required: if x in ['scikit_image', 'scikit_learn', 'opencv_contrib_python']: continue if x not in packages: print(Back.YELLOW + "Not in pip {}".format(x)) all_installed = False try: import sklearn import skimage import cv2 except ImportError as e: print(Back.RED + "Import error for package") print(Back.Red + e) if not all_installed: print( Back.RED + Style.BRIGHT + "Not all packages required were found\ntry running `pip -r requirements.txt` again" + Back.CYAN) else: print(Back.GREEN + "All required packages found" + Back.CYAN) # Commands to Run
Example #9
Source File: colors.py From VxAPI with GNU General Public License v3.0 | 5 votes |
def control(text): text = '\n<<< ' + str(text) + ' >>>\n\r' return Fore.YELLOW + text + Style.RESET_ALL if Color.is_atty() else text
Example #10
Source File: install.py From Yugioh-bot with MIT License | 5 votes |
def download_tesseract(): r = requests.get(domain_tess) dom = html.fromstring(r.text) links = dom.cssselect('a') tess_links = list(filter(lambda x: re.search( tess_search, x.text_content()), links)) original_link = list(filter(lambda x: x.text_content() == tess_tested_against, links)) if len(original_link) == 1: tess_download = original_link[0] print(Back.GREEN + 'Found Expected Tesseract on site ({}), downloading'.format( tess_tested_against)) return download_tesseract_source(tess_download) elif len(tess_links) > 0: print(Back.GREEN + "Found Tesseract links but none of them were tested against this bot") print(Back.GREEN + "Choose one of the following to install") for index, link in enumerate(tess_links): print(Back.GREEN + "{}. {}".format(index + 1, link.text_content())) while True: val = input(Back.GREEN + "Choose: ") if int(val) in range(1, len(tess_links) + 1): tess_download = tess_links[int(val) - 1] break print(Style.BRIGHT + Style.YELLOW + "Invalid value {}".format(val)) return download_tesseract_source(tess_download) else: print(Style.BRIGHT + Style.RED + "Found no Tesseract links to download get help or download manually") return None
Example #11
Source File: install.py From Yugioh-bot with MIT License | 5 votes |
def run_command(command, check_output=False): if DEBUG: print(Fore.WHITE + Back.YELLOW + "Running `{}`".format(command) + Style.NORMAL + Back.CYAN) if check_output: return subprocess.check_output(command, shell=True) return subprocess.call(command, shell=True)
Example #12
Source File: helper.py From PRET with GNU General Public License v2.0 | 5 votes |
def dump(self, data): # experimental regex to match sensitive strings like passwords data = re.sub(r"[\x00-\x06,\x1e]([!-~]{6,}?(?!\\0A))\x00{16}", "START" + r"\1" + "STOP", data) data = re.sub(r"\00+", "\x00", data) # ignore nullbyte streams data = re.sub(r"(\x00){10}", "\x00", data) # ignore nullbyte streams data = re.sub(r"([\x00-\x1f,\x7f-\xff])", ".", data) data = re.sub(r"START([!-~]{6,}?)STOP", Style.RESET_ALL + Back.BLUE + r"\1" + Style.RESET_ALL + Fore.YELLOW, data) self.raw(data, "") # dump ps dictionary
Example #13
Source File: helper.py From PRET with GNU General Public License v2.0 | 5 votes |
def psdir(self, isdir, size, mtime, name, otime): otime = Style.DIM + "(created " + otime + ")" + Style.RESET_ALL vol = Style.DIM + Fore.YELLOW + item(re.findall("^(%.*%)", name)) + Style.RESET_ALL name = re.sub("^(%.*%)", '', name) # remove volume information from filename name = Style.BRIGHT + Fore.BLUE + name + Style.RESET_ALL if isdir else name if isdir: print("d %8s %s %s %s %s" % (size, mtime, otime, vol, name)) else: print("- %8s %s %s %s %s" % (size, mtime, otime, vol, name)) # show directory listing
Example #14
Source File: helper.py From PRET with GNU General Public License v2.0 | 5 votes |
def psfind(self, name): vol = Style.DIM + Fore.YELLOW + item(re.findall("^(%.*%)", name)) + Style.RESET_ALL name = Fore.YELLOW + const.SEP + re.sub("^(%.*%)", '', name) + Style.RESET_ALL print("%s %s" % (vol, name)) # show directory listing
Example #15
Source File: helper.py From PRET with GNU General Public License v2.0 | 5 votes |
def raw(self, msg, eol=None): if msg: print(Fore.YELLOW + msg + Style.RESET_ALL, end=eol) sys.stdout.flush() # show chit-chat
Example #16
Source File: colors.py From cmd2 with MIT License | 5 votes |
def perror(msg: Any, *, end: str = '\n', apply_style: bool = True) -> None: """Override perror() method from `cmd2.Cmd` Use colorama native approach for styling the text instead of `cmd2.ansi` methods :param msg: message to print (anything convertible to a str with '{}'.format() is OK) :param end: string appended after the end of the message, default a newline :param apply_style: If True, then ansi.style_error will be applied to the message text. Set to False in cases where the message text already has the desired style. Defaults to True. """ if apply_style: final_msg = "{}{}{}{}".format(Fore.RED, Back.YELLOW, msg, Style.RESET_ALL) else: final_msg = "{}".format(msg) ansi.ansi_aware_write(sys.stderr, final_msg + end)
Example #17
Source File: colors.py From chepy with GNU General Public License v3.0 | 5 votes |
def yellow_background(s: str) -> str: # pragma: no cover """Yellow color string if tty Args: s (str): String to color Returns: str: Colored string """ if sys.stdout.isatty(): return Back.YELLOW + Fore.BLACK + s + Fore.RESET + Back.RESET else: return s
Example #18
Source File: config.py From scrapple with MIT License | 5 votes |
def traverse_next(page, nextx, results, tabular_data_headers=[], verbosity=0): """ Recursive generator to traverse through the next attribute and \ crawl through the links to be followed. :param page: The current page being parsed :param next: The next attribute of the current scraping dict :param results: The current extracted content, stored in a dict :return: The extracted content, through a generator """ for link in page.extract_links(selector=nextx['follow_link']): if verbosity > 0: print('\n') print(Back.YELLOW + Fore.BLUE + "Loading page ", link.url + Back.RESET + Fore.RESET, end='') r = results.copy() for attribute in nextx['scraping'].get('data'): if attribute['field'] != "": if verbosity > 1: print("\nExtracting", attribute['field'], "attribute", sep=' ', end='') r[attribute['field']] = link.extract_content(**attribute) if not nextx['scraping'].get('table'): result_list = [r] else: tables = nextx['scraping'].get('table', []) for table in tables: table.update({ 'result': r, 'verbosity': verbosity }) table_headers, result_list = link.extract_tabular(**table) tabular_data_headers.extend(table_headers) if not nextx['scraping'].get('next'): for r in result_list: yield (tabular_data_headers, r) else: for nextx2 in nextx['scraping'].get('next'): for tdh, result in traverse_next(link, nextx2, r, tabular_data_headers=tabular_data_headers, verbosity=verbosity): yield (tdh, result)
Example #19
Source File: outputparser.py From screeps_console with MIT License | 5 votes |
def parseLine(line): severity = getSeverity(line) # Add color based on severity if 'severity' not in locals(): severity = 3 if severity == 0: color = Style.DIM + Fore.WHITE elif severity == 1: color = Style.NORMAL + Fore.BLUE elif severity == 2: color = Style.NORMAL + Fore.CYAN elif severity == 3: color = Style.NORMAL + Fore.WHITE elif severity == 4: color = Style.NORMAL + Fore.RED elif severity == 5: color = Style.NORMAL + Fore.BLACK + Back.RED else: color = Style.NORMAL + Fore.BLACK + Back.YELLOW # Replace html tab entity with actual tabs line = clearTags(line) line = line.replace('	', "\t") return color + line + Style.RESET_ALL
Example #20
Source File: colors.py From VxAPI with GNU General Public License v3.0 | 5 votes |
def warning(text): text = '\n\n<<< Warning: ' + str(text) + ' >>>\n' return Back.YELLOW + text + Style.RESET_ALL if Color.is_atty() else text
Example #21
Source File: colors.py From VxAPI with GNU General Public License v3.0 | 5 votes |
def control_without_arrows(text): text = str(text) return Fore.YELLOW + text + Style.RESET_ALL if Color.is_atty() else text
Example #22
Source File: munin_stdout.py From munin with Apache License 2.0 | 4 votes |
def printResult(info, count, total): """ prints the result block :param info: all collected info :param count: counter (number of samples checked) :param total: total number of lines to check :return: """ # Rating and Color info["res_color"] = Back.CYAN # If VT returned results if "total" in info: info["res_color"] = Back.GREEN if info["positives"] > 0: info["res_color"] = Back.YELLOW if info["positives"] > 10: info["res_color"] = Back.RED # Head line printSeparator(count, total, info['res_color'], info["rating"]) headline = "HASH: {0}".format(info["hash"]) if 'comment' in info and info['comment'] != '': headline += " COMMENT: {0}".format(info['comment']) if 'matching_rule' in info and info['matching_rule'] != '': headline += " RULE: {0}".format(info['matching_rule']) printHighlighted(headline) # More VT info if "total" in info: # Result info["result"] = "%s / %s" % (info["positives"], info["total"]) if info["virus"] != "-": printHighlighted("VIRUS: {0}".format(info["virus"])) printHighlighted("TYPE: {1} SIZE: {2} FILENAMES: {0}".format(removeNonAsciiDrop(info["filenames"]), info['filetype'], info['filesize'])) # Tags to show tags = "" if isinstance(info['tags'], list): tags = " ".join(map(lambda x: x.upper(), info['tags'])) # Extra Info printPeInfo(info) printHighlighted("FIRST: {0} LAST: {1} SUBMISSIONS: {5} REPUTATION: {6}\nCOMMENTS: {2} USERS: {3} TAGS: {4}".format( info["first_submitted"], info["last_submitted"], info["comments"], ', '.join(info["commenter"]), tags, info["times_submitted"], info["reputation"] ), tag_color=True) # Print the highlighted result line printHighlighted("RESULT: %s" % (info["result"]), hl_color=info["res_color"])