Bug 406816 - All default themes depend on system UI colors
Summary: All default themes depend on system UI colors
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: theme (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: accessibility
Depends on:
Blocks:
 
Reported: 2019-04-23 15:23 UTC by Friedrich W. H. Kossebau
Modified: 2019-05-22 20:09 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.59


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Friedrich W. H. Kossebau 2019-04-23 15:23:02 UTC
Some colors used for highlighting coming from KSyntaxHighlighting::Repository::defaultTheme() seem to depend on the currently active UI color theme.
This is not documented, and this variance comes at surprise of e.g. printing to paper or rendering into PDF & Co, where the colors then depend on the current system's UI.

Having a default theme adapting to the UI color theme surely also has its uses though, for highlighting of text integrated in UI (messages etc.). So an additional explicit default theme adapting to the current UI theme would make sense, next to bright & dark stable color themes.
Comment 1 Dominik Haumann 2019-05-19 16:11:32 UTC
@Friedrich: This should not be the case. However, "some colors" is too vague, could you be more precise? What highlighting file? What code example? What theme?

The colors are defined in frameworks/syntax-highlighting/data/themes/*.theme.

Could it be the case that you are using xml highlighting files that have hard-coded colors?
Comment 2 Friedrich W. H. Kossebau 2019-05-19 16:40:13 UTC
This was filed in the context of https://phabricator.kde.org/D20766#454924 so I forgot to add more details here, will see to do ASAP.
Then as said in that review comment, could also be the symptom is due to a potential bug 406821.
Comment 3 Dominik Haumann 2019-05-22 20:09:21 UTC
Git commit bbc465981bd55ca5449f5d22e972fccbe994e24f by Dominik Haumann.
Committed on 22/05/2019 at 20:09.
Pushed by dhaumann into branch 'master'.

SyntaxHighlighter: Fix foreground color for text without special highlighting

Summary:
QTextDocument seems to use the widget palette (or application
palette) when drawing text. That is, by default the palette's
foreground color is used when no special QTextCharFormat is
specified.

This patch changes applyFormat() such that the foreground color
is always set to avoid the fallback to the QPalette's foreground
color.
Related: bug 406821
FIXED-IN: 5.59

Test Plan: make && make test + manual testing with the codeeditor example

Reviewers: vkrause, cullmann, kossebau

Reviewed By: cullmann

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D21295

M  +0    -1    examples/codeeditor/codeeditor.cpp
M  +4    -4    src/lib/syntaxhighlighter.cpp

https://commits.kde.org/syntax-highlighting/bbc465981bd55ca5449f5d22e972fccbe994e24f