https://bugs.kde.org/show_bug.cgi?id=406821
--- Comment #3 from Dominik Haumann <dhaum...@kde.org> --- The issue is that QTextDocument uses the application palette by default. Indeed, looking at the codeeditor code (https://github.com/KDE/syntax-highlighting/blob/master/examples/codeeditor.cpp#L198), we can see that the widget palette is changed whenever the theme is changed: void CodeEditor::setTheme(const KSyntaxHighlighting::Theme &theme) { auto pal = qApp->palette(); if (theme.isValid()) { pal.setColor(QPalette::Base, theme.editorColor(KSyntaxHighlighting::Theme::BackgroundColor)); pal.setColor(QPalette::Text, theme.textColor(KSyntaxHighlighting::Theme::Normal)); pal.setColor(QPalette::Highlight, theme.editorColor(KSyntaxHighlighting::Theme::TextSelection)); } setPalette(pal); m_highlighter->setTheme(theme); m_highlighter->rehighlight(); highlightCurrentLine(); } This part is missing in thumbnail/textcreator.cpp. One fix is to do the following: const QPalette appPalette = qApp->palette(); QPalette pal = appPalette; if (theme.isValid()) { pal.setColor(QPalette::Base, theme.editorColor(KSyntaxHighlighting::Theme::BackgroundColor)); pal.setColor(QPalette::Text, theme.textColor(KSyntaxHighlighting::Theme::Normal)); pal.setColor(QPalette::Highlight, theme.editorColor(KSyntaxHighlighting::Theme::TextSelection)); } qApp->setPalette(pal); // ... do the painting qApp->setPalette(appPalette); @Friedrich: Can you check whether this works? If this is being run in a separate process, then you can even drop reverting to the old palette. Another solution would be to change the SyntaxHighlighter implementation in SyntaxHighligher::applyFormat(), see https://github.com/KDE/syntax-highlighting/blob/master/src/lib/syntaxhighlighter.cpp#L159 There, the part "format.isDefaultTextStyle(theme()) || " needs to be removed, this should work as well. -- You are receiving this mail because: You are watching all bug changes.