vcl/source/control/button.cxx |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 013ad7ef72c487d3c26630a0195b2e290ce96047
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Dec 13 19:14:00 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Dec 14 08:54:05 2022 +0000

    tdf#152486 unreadable infobar buttons in macOS dark mode
    
    These are the buttons in infobars where the infobar has a custom
    background color and on these platforms the buttons blend with their
    background. On other platforms the buttons typically are opaque
    and the issue doesn't arise.
    
    Change-Id: Idfc4bbf291953bbf27e73cd5dd7654fd1ce4b051
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144072
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 302198001834..46d7b5123d82 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -895,6 +895,25 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice 
*pDev, SystemTextColorFl
             else
                 aColor = rStyleSettings.GetButtonTextColor();
 
+#if defined(MACOSX) || defined(IOS)
+    // tdf#152486 These are the buttons in infobars where the infobar has a 
custom
+    // background color and on these platforms the buttons blend with
+    // their background.
+    vcl::Window* pParent = GetParent();
+    if (pParent->get_id() == "ExtraButton")
+    {
+        while (pParent && !pParent->IsControlBackground())
+            pParent = pParent->GetParent();
+        if (pParent)
+        {
+            if (aColor.IsBright() && !pParent->GetControlBackground().IsDark())
+                aColor = COL_BLACK;
+            else if (aColor.IsDark() && 
!pParent->GetControlBackground().IsBright())
+                aColor = COL_WHITE;
+        }
+    }
+#endif
+
     pDev->SetTextColor(aColor);
 
     if ( IsEnabled() )

Reply via email to