本文整理汇总了Python中colorama.Style.DIM属性的典型用法代码示例。如果您正苦于以下问题:Python Style.DIM属性的具体用法?Python Style.DIM怎么用?Python Style.DIM使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类colorama.Style
的用法示例。
在下文中一共展示了Style.DIM属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print_results
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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"
示例2: callable_virtualenv
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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')
示例3: banner
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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
示例4: new_version_news
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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
示例5: color
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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
示例6: default_prefix_template
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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)
示例7: colorize_direction
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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
示例8: _colorize_frame
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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)
#
示例9: default_log_template
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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
示例10: _wrap_color
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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
示例11: parseLine
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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
示例12: m_info
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
def m_info(self, m):
m = '[*] ' + m
if COLORAMA:
print Style.DIM + m
else:
print m
示例13: banner
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
def banner():
banner = Style.DIM + """
__ ___ __ ___ | |_ __ _ __ ___
\ \/ / '_ ` _ \| | '__| '_ \ / __|____
> <| | | | | | | | | |_) | (_|_____|
/_/\_\_| |_| |_|_|_| | .__/ \___|
|_|
_ _ __
| |__ _ __ _ _| |_ ___ / _| ___ _ __ ___ ___ _ __
| '_ \| '__| | | | __/ _ \ |_ / _ \| '__/ __/ _ \ '__|
| |_) | | | |_| | || __/ _| (_) | | | (_| __/ |
|_.__/|_| \__,_|\__\___|_| \___/|_| \___\___|_| """ + Style.RESET_ALL
print("{}".format(banner))
示例14: description
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
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
示例15: _reverse_palette
# 需要导入模块: from colorama import Style [as 别名]
# 或者: from colorama.Style import DIM [as 别名]
def _reverse_palette(code):
return {
1 : Fore.BLACK + _back_color(code),
2 : Style.DIM
}