Skip to content

Commit

Permalink
qt_fusionPalette: make links more legible on dark backgrounds
Browse files Browse the repository at this point in the history
QPalette's default for Link is Qt::blue, which is difficult to read
on dark backgrounds.

Use the same blue that is already used for Highlight, as it is
consistent and easy to read.

Task-number: QTBUG-90504
Pick-to: 6.4
Change-Id: Ic7aceafb2bd0e57b65448917c352e3551ad26610
Reviewed-by: Volker Hilsheimer <[email protected]>
  • Loading branch information
mitchcurtis committed Aug 25, 2022
1 parent c6c41cc commit 502c478
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gui/kernel/qplatformtheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ Q_GUI_EXPORT QPalette qt_fusionPalette()
const QColor dark = backGround.darker(150);
const QColor darkDisabled = QColor(209, 209, 209).darker(110);
const QColor text = darkAppearance ? windowText : Qt::black;
const QColor highlight = QColor(48, 140, 198);
const QColor hightlightedText = darkAppearance ? windowText : Qt::white;
const QColor disabledText = darkAppearance ? QColor(130, 130, 130) : QColor(190, 190, 190);
const QColor button = backGround;
Expand All @@ -377,12 +378,16 @@ Q_GUI_EXPORT QPalette qt_fusionPalette()
fusionPalette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled);
fusionPalette.setBrush(QPalette::Disabled, QPalette::Shadow, disabledShadow);

fusionPalette.setBrush(QPalette::Active, QPalette::Highlight, QColor(48, 140, 198));
fusionPalette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(48, 140, 198));
fusionPalette.setBrush(QPalette::Active, QPalette::Highlight, highlight);
fusionPalette.setBrush(QPalette::Inactive, QPalette::Highlight, highlight);
fusionPalette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(145, 145, 145));

fusionPalette.setBrush(QPalette::PlaceholderText, placeholder);

// Use a more legible light blue on dark backgrounds than the default Qt::blue.
if (darkAppearance)
fusionPalette.setBrush(QPalette::Link, highlight);

return fusionPalette;
}

Expand Down

0 comments on commit 502c478

Please sign in to comment.