Skip to content

Truly independent web browser

UI/Qt: Keep white text readable on the checked find button

Andreas Kling7019ab677b4b
diff --git a/UI/Qt/ChromeStyle.cpp b/UI/Qt/ChromeStyle.cpp
index ace93bb07a2..4340229c674 100644
--- a/UI/Qt/ChromeStyle.cpp
+++ b/UI/Qt/ChromeStyle.cpp
@@ -756,7 +756,7 @@ QFrame#LadybirdFindInPageSeparator {{
}}
)",
style_sheet_color(panel.page), style_sheet_color(panel.text), style_sheet_color(panel.muted), style_sheet_color(panel.body),
- style_sheet_color(panel.control), style_sheet_color(no_match_fill), style_sheet_color(Theme::accent()),
+ style_sheet_color(panel.control), style_sheet_color(no_match_fill), style_sheet_color(Theme::accent_fill()),
style_sheet_color(panel.separator), style_sheet_color(no_match_text))
+ panel_text_selection_style_sheet({ "QWidget#LadybirdFindInPageField QLineEdit" }, panel.text);
}
diff --git a/UI/Qt/Theme.cpp b/UI/Qt/Theme.cpp
index 61aeb4b9192..128a0d3c158 100644
--- a/UI/Qt/Theme.cpp
+++ b/UI/Qt/Theme.cpp
@@ -524,10 +524,13 @@ TextSelectionColors panel_text_selection(QPalette::ColorGroup group, QColor cons
return text_selection(group, is_dark(), chrome().toolbar, text);
}
-// The theme's accent fills primary buttons and selected rows deep enough that white text on them clears 4.5:1.
-static QColor accent_fill()
+// The accent fills primary buttons, selected rows and checked buttons deep enough that white text on them clears 4.5:1.
+QColor accent_fill()
{
- return with_contrast(*s_color_theme.accent, Qt::white, 4.5f, Adjustment::Darken);
+ if (auto const& base_color = s_color_theme.accent.has_value() ? s_color_theme.accent : s_desktop_accent; base_color.has_value())
+ return with_contrast(*base_color, Qt::white, 4.5f, Adjustment::Darken);
+ auto const& accent = system_accent_color();
+ return with_contrast(is_dark() ? accent.dark : accent.light, Qt::white, 4.5f, Adjustment::Darken);
}
QColor primary()
diff --git a/UI/Qt/Theme.h b/UI/Qt/Theme.h
index a6a66d09ecb..5739457573c 100644
--- a/UI/Qt/Theme.h
+++ b/UI/Qt/Theme.h
@@ -114,6 +114,9 @@ struct TextSelectionColors {
TextSelectionColors address_field_text_selection(QPalette const&, QPalette::ColorGroup);
TextSelectionColors panel_text_selection(QPalette::ColorGroup, QColor const& text);
+// The accent, deep enough that white text on it stays clear.
+QColor accent_fill();
+
// The fill of a primary button, a blue that white text stays clear on.
QColor primary();
// The fill of the selected row of a menu or a list navigated with the keyboard.