pygments.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:rice 作者: randy3k 项目源码 文件源码
def style_from_pygments(pygments_style_cls=None):
    """
    Shortcut to create a :class:`.Style` instance from a Pygments style class
    and a style dictionary.

    Example::

        from prompt_toolkit.styles.from_pygments import style_from_pygments
        from pygments.styles import get_style_by_name
        style = style_from_pygments(get_style_by_name('monokai'))

    :param pygments_style_cls: Pygments style class to start from.
    """
    # Import inline.
    from pygments.style import Style as pygments_Style
    assert issubclass(pygments_style_cls, pygments_Style)

    pygments_style = []

    if pygments_style_cls is not None:
        for token, style in pygments_style_cls.styles.items():
            pygments_style.append((_pygments_token_to_classname(token), style))

    return Style(pygments_style)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号