Python colorama.Back.CYAN Examples
The following are 11
code examples of colorama.Back.CYAN().
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: 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 #2
Source File: install.py From Yugioh-bot with MIT License | 6 votes |
def copy_nox_bin_files(): adb_file_name = 'nox_adb.exe' dll_file_name = 'AdbWinApi.dll' path = NOX_BIN try: os.stat(os.path.join(path, adb_file_name)) os.stat(os.path.join(path, dll_file_name)) except FileNotFoundError: try: path = NOX_BIN_OTHER os.stat(os.path.join(path, adb_file_name)) os.stat(os.path.join(path, dll_file_name)) except FileNotFoundError: print(Fore.RED + """Cannot find the required nox files in either {} or {}, help is requireed""".format(NOX_BIN_OTHER, NOX_BIN)) return copyfile(os.path.join(path, adb_file_name), os.path.join('bin', 'adb.exe')) copyfile(os.path.join(path, dll_file_name), os.path.join('bin', dll_file_name)) print(Back.GREEN + "Copied [{}] into bin folder".format(', '.join([adb_file_name, dll_file_name])) + Back.CYAN)
Example #3
Source File: install.py From Yugioh-bot with MIT License | 6 votes |
def install_tesseract(): is_installed, message = check_if_tesseract_installed() if is_installed: print(Back.GREEN + message + Back.CYAN) return try: os.stat(TESSERACT_SETUP_FILE) command_runner(TESSERACT_SETUP_FILE) except FileNotFoundError: setup_file = download_tesseract() try: print(Style.BRIGHT + Back.CYAN + 'Make sure to point the installer to the following directory: {}'.format( os.path.join(os.getcwd(), 'bin', 'tess'))) command_runner(setup_file) except FileNotFoundError: print("Oooo something happened when I downloaded the file, rerun this script")
Example #4
Source File: internal.py From cheat.sh with MIT License | 5 votes |
def _back_color(code): if code == 0 or (isinstance(code, str) and code.lower() == "white"): return Back.WHITE if code == 1 or (isinstance(code, str) and code.lower() == "cyan"): return Back.CYAN if code == 2 or (isinstance(code, str) and code.lower() == "red"): return Back.RED return Back.WHITE
Example #5
Source File: helper.py From PRET with GNU General Public License v2.0 | 5 votes |
def send(self, str, mode): if str: print(Back.CYAN + str + Style.RESET_ALL) if str and mode == 'hex': print(Fore.CYAN + conv().hex(str, ':') + Style.RESET_ALL) # show recv commands (debug mode)
Example #6
Source File: prints.py From PyFunceble with Apache License 2.0 | 5 votes |
def _colorify(self, data): """ Retun colored string. :param str data: The string to colorify. :return: A colored string. :rtype: str """ if self.template in ["Generic", "Less"]: # The template is in the list of template that need the coloration. if ( self.data_to_print[1].lower() in PyFunceble.STATUS.list.up or self.data_to_print[1].lower() in PyFunceble.STATUS.list.valid or self.data_to_print[1].lower() in PyFunceble.STATUS.list.sane ): # The status is in the list of up status. # We print the data with a green background. data = Fore.BLACK + Back.GREEN + data elif ( self.data_to_print[1].lower() in PyFunceble.STATUS.list.down or self.data_to_print[1].lower() in PyFunceble.STATUS.list.malicious ): # The status is in the list of down status. # We print the data with a red background. data = Fore.BLACK + Back.RED + data else: # The status is not in the list of up and down status. # We print the data with a cyan background. data = Fore.BLACK + Back.CYAN + data # We return the data. return data
Example #7
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 #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: install.py From Yugioh-bot with MIT License | 5 votes |
def main_install(): print(Back.CYAN + Style.BRIGHT + warning) print(Back.CYAN + "Installing Required components to get this bot up and running") for index, command in enumerate(commands): print(Back.CYAN + "Component {}: {}{}".format(index, Fore.RED, command[0]) + Fore.WHITE) command_runner(command[1])
Example #10
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"])
Example #11
Source File: test_output_prints.py From PyFunceble with Apache License 2.0 | 4 votes |
def test_colorify(self): """ Tests the method which colors a line depending of the status. """ # pylint: disable=protected-access expected = False actual = self.file_instance.exists() self.assertEqual(expected, actual) # Test with a template that is not designed for colorify expected = self.to_print["basic_string"] actual = Prints(None, "Hehehe", output_file=None, only_on_file=False)._colorify( self.to_print["basic_string"] ) self.assertEqual(expected, actual) # Test with a template that is designed for colorify + Status is UP expected = Fore.BLACK + Back.GREEN + self.to_print["basic_string"] actual = Prints( ["This is a test", PyFunceble.STATUS.official.up], "Generic", output_file=None, only_on_file=False, )._colorify(self.to_print["basic_string"]) self.assertEqual(expected, actual) # Test with a template that is designed for colorify + Status is DOWN expected = Fore.BLACK + Back.RED + self.to_print["basic_string"] actual = Prints( ["This is a test", PyFunceble.STATUS.official.down], "Generic", output_file=None, only_on_file=False, )._colorify(self.to_print["basic_string"]) self.assertEqual(expected, actual) # Test with a template that is designed for colorify + Status is # UNKNOWN or INVALID expected = Fore.BLACK + Back.CYAN + self.to_print["basic_string"] actual = Prints( ["This is a test", PyFunceble.STATUS.official.invalid], "Generic", output_file=None, only_on_file=False, )._colorify(self.to_print["basic_string"]) self.assertEqual(expected, actual)