def format(color, style=''):
word_color = QColor()
word_color.setNamedColor(color)
word_format = QTextCharFormat()
word_format.setForeground(word_color)
if 'italic' in style:
word_format.setFontItalic(True)
elif 'bold' in style:
word_format.setFontWeight(QFont.Bold)
return word_format
评论列表
文章目录