def __init__(self, doc): QSyntaxHighlighter.__init__(self, doc) self.colors = {} self.colors['doctype'] = QColor(192, 192, 192) self.colors['entity'] = QColor(128, 128, 128) self.colors['comment'] = QColor(35, 110, 37) if is_dark_theme(): from calibre.gui2.palette import dark_link_color self.colors['tag'] = QColor(186, 78, 188) self.colors['attrname'] = QColor(193, 119, 60) self.colors['attrval'] = dark_link_color else: self.colors['tag'] = QColor(136, 18, 128) self.colors['attrname'] = QColor(153, 69, 0) self.colors['attrval'] = QColor(36, 36, 170)
def rehighlight(self): QApplication.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) QSyntaxHighlighter.rehighlight(self) QApplication.restoreOverrideCursor()