def format(color, style=None):
"""
Return a QTextCharFormat with the given attributes.
:param color:
The color to format the text.
:param style: [optional]
The styling for the text.
"""
_color = QtGui.QColor()
_color.setNamedColor(color)
_format = QtGui.QTextCharFormat()
_format.setForeground(_color)
if style is not None and 'bold' in style:
_format.setFontWeight(QtGui.QFont.Bold)
if style is not None and 'italic' in style:
_format.setFontItalic(True)
return _format
# Syntax styles that can be shared by all languages
评论列表
文章目录