Python colorama.Style.DIM Examples
The following are 30
code examples of colorama.Style.DIM().
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.Style
, or try the search function
.
Example #1
Source File: example_python_operator.py From airflow with Apache License 2.0 | 6 votes |
def callable_virtualenv(): """ Example function that will be performed in a virtual environment. Importing at the module level ensures that it will not attempt to import the library before it is installed. """ from colorama import Fore, Back, Style from time import sleep print(Fore.RED + 'some red text') print(Back.GREEN + 'and with a green background') print(Style.DIM + 'and in dim text') print(Style.RESET_ALL) for _ in range(10): print(Style.DIM + 'Please wait...', flush=True) sleep(10) print('Finished')
Example #2
Source File: display.py From lightnovel-crawler with Apache License 2.0 | 6 votes |
def new_version_news(latest): print('', Icons.PARTY + Style.BRIGHT + Fore.CYAN, 'VERSION', Fore.RED + latest + Fore.CYAN, 'IS NOW AVAILABLE!', Fore.RESET) print('', Icons.RIGHT_ARROW, Style.DIM + 'Upgrade:', Fore.YELLOW + 'pip install -U lightnovel-crawler', Style.RESET_ALL) if Icons.isWindows: print('', Icons.RIGHT_ARROW, Style.DIM + 'Download:', Fore.YELLOW + 'https://rebrand.ly/lncrawl', Style.RESET_ALL) elif Icons.isLinux: print('', Icons.RIGHT_ARROW, Style.DIM + 'Download:', Fore.YELLOW + 'https://rebrand.ly/lncrawl-linux', Style.RESET_ALL) # end if print('-' * LINE_SIZE) # end def
Example #3
Source File: _grep.py From nbcommands with Apache License 2.0 | 6 votes |
def color(s, c, style="bright"): color_map = { "black": Fore.BLACK, "red": Fore.RED, "green": Fore.GREEN, "yellow": Fore.YELLOW, "blue": Fore.BLUE, "magenta": Fore.MAGENTA, "cyan": Fore.CYAN, "white": Fore.WHITE, } style_map = { "dim": Style.DIM, "normal": Style.NORMAL, "bright": Style.BRIGHT, } return color_map[c] + style_map[style] + s + Style.RESET_ALL
Example #4
Source File: output.py From drydock with GNU General Public License v2.0 | 6 votes |
def print_results(self,results): try: if results['status'] == 'Pass': print ("Status: " + Fore.GREEN + 'Pass' + Fore.RESET) elif results['status'] == 'Fail': print ("Status: " + Fore.RED + 'Fail' + Fore.RESET) except KeyError: pass except TypeError: pass print "Description: " + results['descr'] try: res = str(results['output']) print "Output: " print(Style.DIM + res + Style.RESET_ALL) except KeyError: pass print "\n"
Example #5
Source File: log.py From odoo-module-migrator with GNU Affero General Public License v3.0 | 6 votes |
def default_prefix_template(self, record): """Return the prefix for the log message. Template for Formatter. :param: record: :py:class:`logging.LogRecord` object. this is passed in from inside the :py:meth:`logging.Formatter.format` record. """ reset = [Style.RESET_ALL] levelname = [ LEVEL_COLORS.get(record.levelname), Style.BRIGHT, '%(levelname)-10s', Style.RESET_ALL, ' ' ] asctime = [ '', Fore.BLACK, Style.DIM, Style.BRIGHT, '%(asctime)-10s', Fore.RESET, Style.RESET_ALL, ' ' ] return "".join(reset + asctime + levelname + reset)
Example #6
Source File: helper.py From PRET with GNU General Public License v2.0 | 5 votes |
def pcldir(self, size, mtime, id, name): id = Style.DIM + "(macro id: " + id + ")" + Style.RESET_ALL print("- %8s %s %s %s" % (size, mtime, id, name)) # show output from df
Example #7
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 #8
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 #9
Source File: gasmask.py From gasmask with GNU General Public License v3.0 | 5 votes |
def print_res(path, match, val): """ Printing Results - Censys.io """ sep = ' ' pre = '[...]' post = pre pos = match.lower().index(val.lower()) if len(match) >= 80: if pos < 35: pre = '' match_c = Style.DIM + pre + match[pos - 35:pos] + Fore.RED + Style.BRIGHT + match[ pos:pos + len( val)] + \ Style.RESET_ALL + Style.DIM + match[ pos + len(val):pos + 35] + post + Style.RESET_ALL match = pre + match[pos - 35:pos + 35] + post else: match_c = Style.DIM + match[:pos] + Fore.RED + Style.BRIGHT + match[pos:pos + len(val)] + \ Style.RESET_ALL + Style.DIM + match[pos + len(val):] + Style.RESET_ALL match_c = match_c.replace('\n', '\\n') match_c = match_c.replace('\r', '\\r') match = match.replace('\n', '\\n') match = match.replace('\r', '\\r') if len(path) >= 60: sep = '\n\t' if sys.stdout.isatty(): print(" %s:%s%s" % (path, sep, match_c)) else: print(" %s:%s%s" % (path, sep, match))
Example #10
Source File: helper.py From PRET with GNU General Public License v2.0 | 5 votes |
def errmsg(self, msg, info=""): info = str(info).strip() if info: # monkeypatch to make python error message less ugly info = item(re.findall('Errno -?\d+\] (.*)', info), '') or info.splitlines()[-1] info = Style.RESET_ALL + Style.DIM + " (" + info.strip('<>') + ")" + Style.RESET_ALL if msg: print(Back.RED + msg + info) # show printer and status
Example #11
Source File: display.py From lightnovel-crawler with Apache License 2.0 | 5 votes |
def description(): print('=' * LINE_SIZE) title = Icons.BOOK + ' Lightnovel Crawler ' + \ Icons.CLOVER + os.getenv('version') padding = ' ' * ((LINE_SIZE - len(title)) // 2) print(Fore.YELLOW, padding + title, Fore.RESET) desc = 'https://github.com/dipu-bd/lightnovel-crawler' padding = ' ' * ((LINE_SIZE - len(desc)) // 2) print(Style.DIM, padding + desc, Style.RESET_ALL) print('-' * LINE_SIZE) # end def
Example #12
Source File: helper.py From PRET with GNU General Public License v2.0 | 5 votes |
def chitchat(self, msg, eol=None): if msg: print(Style.DIM + msg + Style.RESET_ALL, end=eol) sys.stdout.flush() # show warning message
Example #13
Source File: core.py From Weibo-Album-Crawler with MIT License | 5 votes |
def __download_album(self, album): """ 下载单个相册 :param album: 相册数据 :return: None """ # 相册所有图片的id all_photo_ids = WeiboApi.fetch_photo_ids(self.uid, album['album_id'], album['type']) self.logger.info(Fore.BLUE + '检测到 %d 张图片' % len(all_photo_ids)) # 相册所有大图的数据 all_large_pics = self.__fetch_large_pics(album, all_photo_ids) total = len(all_large_pics) # 下载所有大图 with concurrent.futures.ThreadPoolExecutor() as executor: album_path = self.__make_album_path(album) future_to_large = { executor.submit(self.__download_pic, large, album_path): large for large in all_large_pics } for i, future in enumerate(concurrent.futures.as_completed(future_to_large)): large = future_to_large[future] count_msg = '%d/%d ' % (i + 1, total) try: result, path = future.result() except Exception as exc: err = '%s 抛出了异常: %s' % (WeiboApi.make_large_url(large), exc) self.logger.error(''.join([Fore.RED, count_msg, err])) else: style = result and Style.NORMAL or Style.DIM self.logger.info(''.join([Fore.GREEN, style, count_msg, path])) else: self.logger.info(Fore.BLUE + '《%s》 已完成' % album['caption'])
Example #14
Source File: pipelines.py From daywatch with MIT License | 5 votes |
def process_item(self, item, spider): print('%s%s%s %s%s (%s %s%s%s, %s)' % (Fore.GREEN, item['hash_id'][:10], Fore.RESET+Style.BRIGHT, item['offer'], Style.RESET_ALL, item['currency'], Fore.YELLOW+Style.DIM, item['price'], Fore.RESET+Style.RESET_ALL, item['discount'] if 'discount' in item else '?')) return item
Example #15
Source File: cli.py From pynubank with MIT License | 5 votes |
def main(): init() log(f'Starting {Fore.MAGENTA}{Style.DIM}PyNubank{Style.NORMAL}{Fore.LIGHTBLUE_EX} context creation.') device_id = generate_random_id() log(f'Generated random id: {device_id}') cpf = input(f'[>] Enter your CPF(Numbers only): ') password = getpass('[>] Enter your password (Used on the app/website): ') generator = CertificateGenerator(cpf, password, device_id) log('Requesting e-mail code') try: email = generator.request_code() except NuException: log(f'{Fore.RED}Failed to request code. Check your credentials!', Fore.RED) return log(f'Email sent to {Fore.LIGHTBLACK_EX}{email}{Fore.LIGHTBLUE_EX}') code = input('[>] Type the code received by email: ') cert1, cert2 = generator.exchange_certs(code) save_cert(cert1, 'cert.p12') print(f'{Fore.GREEN}Certificates generated successfully. (cert.pem)') print(f'{Fore.YELLOW}Warning, keep these certificates safe (Do not share or version in git)')
Example #16
Source File: cli.py From pynubank with MIT License | 5 votes |
def log(message, color=Fore.BLUE): print(f'{color}{Style.DIM}[*] {Style.NORMAL}{Fore.LIGHTBLUE_EX}{message}')
Example #17
Source File: internal.py From cheat.sh with MIT License | 5 votes |
def _reverse_palette(code): return { 1 : Fore.BLACK + _back_color(code), 2 : Style.DIM }
Example #18
Source File: userio.py From LibreNews-Server with GNU General Public License v3.0 | 5 votes |
def say(message): print(prefix + Style.DIM + message + Style.RESET_ALL)
Example #19
Source File: ansi_utils.py From rate.sx with MIT License | 5 votes |
def colorize_direction(direction): """ Green for the up direction, gray for the same, and red for the down direction """ if direction == 1: return Fore.GREEN + '↑' + Style.RESET_ALL if direction == -1: return Fore.RED + '↓' + Style.RESET_ALL return Style.DIM + '=' + Style.RESET_ALL
Example #20
Source File: 8080.py From 8080py with GNU General Public License v3.0 | 5 votes |
def banner(): print(Style.DIM) print(' ___________________________') print(' / /\\') print(' / sadboyzvone\'s _/ /\\') print(' / Intel 8080 / \/') print(' / Assembler /\\') print('/___________________________/ /') print('\___________________________\/') print(' \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\' + Style.RESET_ALL + Style.BRIGHT) print(Fore.WHITE + '\nPowered by ' + Fore.BLUE + 'Pyt' + Fore.YELLOW + 'hon' + Fore.WHITE + '\nCopyright (C) 2017, Zvonimir Rudinski') # Print usage information
Example #21
Source File: xmlrpc-bruteforcer.py From xmlrpc-bruteforcer with Apache License 2.0 | 5 votes |
def banner(): banner = Style.DIM + """ __ ___ __ ___ | |_ __ _ __ ___ \ \/ / '_ ` _ \| | '__| '_ \ / __|____ > <| | | | | | | | | |_) | (_|_____| /_/\_\_| |_| |_|_|_| | .__/ \___| |_| _ _ __ | |__ _ __ _ _| |_ ___ / _| ___ _ __ ___ ___ _ __ | '_ \| '__| | | | __/ _ \ |_ / _ \| '__/ __/ _ \ '__| | |_) | | | |_| | || __/ _| (_) | | | (_| __/ | |_.__/|_| \__,_|\__\___|_| \___/|_| \___\___|_| """ + Style.RESET_ALL print("{}".format(banner))
Example #22
Source File: aesthetics.py From BrundleFuzz with MIT License | 5 votes |
def m_info(self, m): m = '[*] ' + m if COLORAMA: print Style.DIM + m else: print m
Example #23
Source File: aesthetics.py From BrundleFuzz with MIT License | 5 votes |
def m_info(self, m): m = '[*] ' + m if COLORAMA: print Style.DIM + m else: print m
Example #24
Source File: aesthetics.py From BrundleFuzz with MIT License | 5 votes |
def m_info(self, m): m = '[*] ' + m if COLORAMA: print Style.DIM + m else: print m
Example #25
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 #26
Source File: print_nodes.py From pyta with GNU General Public License v3.0 | 5 votes |
def _wrap_color(code_string): """Wrap key parts in styling and resets. Stying for each key part from, (col_offset, fromlineno) to (end_col_offset, end_lineno). Note: use this to set color back to default (on mac, and others?): Style.RESET_ALL + Style.DIM """ ret = Style.BRIGHT + Fore.WHITE + Back.BLACK ret += code_string ret += Style.RESET_ALL + Style.DIM + Fore.RESET + Back.RESET return ret
Example #27
Source File: log.py From git-aggregator with GNU Affero General Public License v3.0 | 5 votes |
def default_log_template(self, record): """Return the prefix for the log message. Template for Formatter. :param: record: :py:class:`logging.LogRecord` object. this is passed in from inside the :py:meth:`logging.Formatter.format` record. """ reset = [Style.RESET_ALL] levelname = [ LEVEL_COLORS.get(record.levelname), Style.BRIGHT, '(%(levelname)s)', Style.RESET_ALL, ' ' ] asctime = [ '[', Fore.BLACK, Style.DIM, Style.BRIGHT, '%(asctime)s', Fore.RESET, Style.RESET_ALL, ']' ] name = [ ' ', Fore.WHITE, Style.DIM, Style.BRIGHT, '%(name)s', Fore.RESET, Style.RESET_ALL, ' ' ] threadName = [ ' ', Fore.BLUE, Style.DIM, Style.BRIGHT, '%(threadName)s ', Fore.RESET, Style.RESET_ALL, ' ' ] tpl = "".join(reset + levelname + asctime + name + threadName + reset) return tpl
Example #28
Source File: view_ansi.py From rate.sx with MIT License | 5 votes |
def _colorize_frame(s_frame): """ Colorize frame in string s_frame """ output = [] for line in s_frame.splitlines(): line = line.decode('utf-8')\ .replace(u'lqqqq', Style.DIM + u'lqqqq')\ .replace(u'tqqqq', Style.DIM + u'tqqqq')\ .replace(u'mqqqq', Style.DIM + u'mqqqq')\ .replace(u'x', Style.DIM + u'x' + Style.RESET_ALL)\ .replace(u'qqqqk', u'qqqqk' + Style.RESET_ALL)\ .replace(u'qqqqu', u'qqqqu' + Style.RESET_ALL)\ .replace(u'qqqqj', u'qqqqj' + Style.RESET_ALL)\ .encode('utf-8') line = line.decode('utf-8')\ .replace(u'┌────', Style.DIM + u'┌────')\ .replace(u'├────', Style.DIM + u'├────')\ .replace(u'└────', Style.DIM + u'└────')\ .replace(u'│', Style.DIM + u'│' + Style.RESET_ALL)\ .replace(u'────┐', u'────┐' + Style.RESET_ALL)\ .replace(u'────┤', u'────┤' + Style.RESET_ALL)\ .replace(u'────┘', u'────┘' + Style.RESET_ALL)\ .encode('utf-8') output.append(line) return "\n".join(output) # # that's everything we need to save (and to load later) #
Example #29
Source File: stress_test.py From certvalidator with MIT License | 4 votes |
def _color(name, status, text, start=None, *extras): """ Prints a status message with color :param name: A unicode string of "green", "yellow" or "red" to color the status with :param status: A unicode string of the status to print :param text: A unicode string of the text to print after the status :param start: A float from time.time() of when the status started - used to print duration :param extras: A list of unicode strings of extra information about the status """ color_const = { 'green': Fore.GREEN, 'red': Fore.RED, 'yellow': Fore.YELLOW, }[name] if start is not None: length = round((time.time() - start) * 1000.0) duration = '%sms' % length else: duration = '' sys.stdout.write( '[%s%s%s] %s %s%s%s\n' % ( color_const, status, Fore.RESET, text, Style.DIM, duration, Style.RESET_ALL ) ) for extra in extras: indent_len = len(status) + 3 wrapped_message = '\n'.join(textwrap.wrap( extra, 120, initial_indent=' ' * indent_len, subsequent_indent=' ' * indent_len )) message = '%s%s%s' % (Style.DIM, wrapped_message, Style.RESET_ALL) try: print(message) except (UnicodeEncodeError): print(message.encode('utf-8'))
Example #30
Source File: onshape_to_robot.py From onshape-to-robot with MIT License | 4 votes |
def buildRobot(tree, matrix): occurrence = getOccurrence([tree['id']]) instance = occurrence['instance'] print(Fore.BLUE + Style.BRIGHT + '* Adding top-level instance ['+instance['name']+']' + Style.RESET_ALL) # Build a part name that is unique but still informative link = processPartName(instance['name'], instance['configuration'], occurrence['linkName']) # Create the link, collecting all children in the tree assigned to this top-level part robot.startLink(link, matrix) for occurrence in occurrences.values(): if occurrence['assignation'] == tree['id'] and occurrence['instance']['type'] == 'Part': name = '_'.join(occurrence['path']) extra = '' if occurrence['instance']['configuration'] != 'default': extra = Style.DIM + ' (configuration: '+occurrence['instance']['configuration']+')' print(Fore.GREEN + '+ Adding part '+occurrence['instance']['name']+extra + Style.RESET_ALL) addPart(occurrence, matrix) robot.endLink() # Adding the frames (linkage is relative to parent) if tree['id'] in frames: for name, part in frames[tree['id']]: frame = getOccurrence(part)['transform'] if robot.relative: frame = np.linalg.inv(matrix)*frame robot.addFrame(name, frame) # Following the children in the tree, calling this function recursively k = 0 for child in tree['children']: worldAxisFrame = child['axis_frame'] zAxis = child['z_axis'] jointType = child['jointType'] jointLimits = child['jointLimits'] if robot.relative: axisFrame = np.linalg.inv(matrix)*worldAxisFrame childMatrix = worldAxisFrame else: # In SDF format, everything is expressed in the world frame, in this case # childMatrix will be always identity axisFrame = worldAxisFrame childMatrix = matrix subLink = buildRobot(child, childMatrix) robot.addJoint(jointType, link, subLink, axisFrame, child['dof_name'], jointLimits, zAxis) return link # Start building the robot