diff options
author | networkException <git@nwex.de> | 2023-03-14 14:34:26 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-14 14:56:37 +0100 |
commit | 1a958633fa3f0ed86793c5ab31812b284727b65b (patch) | |
tree | 36a12a14933afc47c0fa1574d2ab5cb55da7a69f /Ladybird/LocationEdit.cpp | |
parent | b96920a9d6e04f1f19c598d94cb78d67bd8635b9 (diff) | |
download | serenity-1a958633fa3f0ed86793c5ab31812b284727b65b.zip |
Ladybird: Rely on transparent text color for location highlighting
This patch replaces the usage of QPalette::PlaceholderText with
QPalette::Text with opacity reduced to roughly 50%. This fixes the non
highlighted spans having an extremely low contrast compared to the
background in dark mode.
Diffstat (limited to 'Ladybird/LocationEdit.cpp')
-rw-r--r-- | Ladybird/LocationEdit.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Ladybird/LocationEdit.cpp b/Ladybird/LocationEdit.cpp index 61489c0b16..e2368444c4 100644 --- a/Ladybird/LocationEdit.cpp +++ b/Ladybird/LocationEdit.cpp @@ -39,6 +39,9 @@ void LocationEdit::highlight_location() { auto url = AK::URL::create_with_url_or_path(ak_deprecated_string_from_qstring(text())); + auto darkened_text_color = QPalette().color(QPalette::Text); + darkened_text_color.setAlpha(127); + QList<QInputMethodEvent::Attribute> attributes; if (url.is_valid() && !hasFocus()) { if (url.scheme() == "http" || url.scheme() == "https" || url.scheme() == "gemini") { @@ -49,7 +52,7 @@ void LocationEdit::highlight_location() // for now just highlight the whole host QTextCharFormat defaultFormat; - defaultFormat.setForeground(QPalette().color(QPalette::PlaceholderText)); + defaultFormat.setForeground(darkened_text_color); attributes.append({ QInputMethodEvent::TextFormat, -cursorPosition(), @@ -67,7 +70,7 @@ void LocationEdit::highlight_location() }); } else if (url.scheme() == "file") { QTextCharFormat schemeFormat; - schemeFormat.setForeground(QPalette().color(QPalette::PlaceholderText)); + schemeFormat.setForeground(darkened_text_color); attributes.append({ QInputMethodEvent::TextFormat, -cursorPosition(), |