本文整理匯總了Python中prompt_toolkit.styles.style_from_dict方法的典型用法代碼示例。如果您正苦於以下問題:Python styles.style_from_dict方法的具體用法?Python styles.style_from_dict怎麽用?Python styles.style_from_dict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類prompt_toolkit.styles
的用法示例。
在下文中一共展示了styles.style_from_dict方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: color_mapping
# 需要導入模塊: from prompt_toolkit import styles [as 別名]
# 或者: from prompt_toolkit.styles import style_from_dict [as 別名]
def color_mapping(curr_completion, completion, prompt, command, subcommand,
param, text, line, example, toolbar):
return style_from_dict({
# Completion colors
Token.Menu.Completions.Completion.Current: curr_completion,
Token.Menu.Completions.Completion: completion,
Token.Menu.Completions.ProgressButton: 'bg:#b78991',
Token.Menu.Completions.ProgressBar: 'bg:#ffc0cb',
Token.Az: prompt,
Token.Prompt.Arg: prompt,
# Pretty Words
Token.Keyword: command,
Token.Keyword.Declaration: subcommand,
Token.Name.Class: param,
Token.Text: text,
Token.Line: line,
Token.Number: example,
# toolbar
Token.Operator: toolbar,
Token.Toolbar: toolbar
})
示例2: style_from_dict
# 需要導入模塊: from prompt_toolkit import styles [as 別名]
# 或者: from prompt_toolkit.styles import style_from_dict [as 別名]
def style_from_dict(d):
styles = default_style_extensions.copy()
styles.update(DefaultStyle.styles)
styles.update(d)
PromptStyle = type('PromptStyle', (Style,), {'styles': styles})
return PromptStyle
示例3: style_factory
# 需要導入模塊: from prompt_toolkit import styles [as 別名]
# 或者: from prompt_toolkit.styles import style_from_dict [as 別名]
def style_factory(self, style_name):
"""Retrieve the specified pygments style.
If the specified style is not found, the vim style is returned.
:type style_name: str
:param style_name: The pygments style name.
:rtype: :class:`pygments.style.StyleMeta`
:return: Pygments style info.
"""
try:
style = get_style_by_name(style_name)
except ClassNotFound:
style = get_style_by_name('vim')
# Create a style dictionary.
styles = {}
styles.update(style.styles)
styles.update(default_style_extensions)
t = Token
styles.update({
t.Menu.Completions.Completion.Current: 'bg:#00aaaa #000000',
t.Menu.Completions.Completion: 'bg:#008888 #ffffff',
t.Menu.Completions.Meta.Current: 'bg:#00aaaa #000000',
t.Menu.Completions.Meta: 'bg:#00aaaa #ffffff',
t.Scrollbar.Button: 'bg:#003333',
t.Scrollbar: 'bg:#00aaaa',
t.Toolbar: 'bg:#222222 #cccccc',
t.Toolbar.Off: 'bg:#222222 #696969',
t.Toolbar.On: 'bg:#222222 #ffffff',
t.Toolbar.Search: 'noinherit bold',
t.Toolbar.Search.Text: 'nobold',
t.Toolbar.System: 'noinherit bold',
t.Toolbar.Arg: 'noinherit bold',
t.Toolbar.Arg.Text: 'nobold'
})
return style_from_dict(styles)