Improve theme colour contrast.

Fixes #4407
Fixes #4637

Additional changes:
- Fix reference entry colour being incompatible with dark themes
- Fix QWizard page being too bright in dark mode
- Prevent unfocused wheel scroll changes to theme setting
This commit is contained in:
Janek Bevendorff 2020-03-07 00:58:56 +01:00
parent 1a3dc2145d
commit 8d2f7832ed
9 changed files with 82 additions and 53 deletions

View file

@ -283,12 +283,11 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
foregroundColor.setNamedColor(entry->foregroundColor());
if (entry->hasReferences()) {
QPalette p;
#ifdef Q_OS_MACOS
if (macUtils()->isDarkMode()) {
return QVariant(p.color(QPalette::Inactive, QPalette::Dark));
}
#endif
return QVariant(p.color(QPalette::Active, QPalette::Mid));
foregroundColor = p.color(QPalette::Current, QPalette::Text);
int lightness =
qMin(255, qMax(0, foregroundColor.lightness() + (foregroundColor.lightness() < 110 ? 85 : -51)));
foregroundColor.setHsl(foregroundColor.hue(), foregroundColor.saturation(), lightness);
return QVariant(foregroundColor);
} else if (foregroundColor.isValid()) {
return QVariant(foregroundColor);
}