diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-12-13 19:14:00 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-12-14 08:53:53 +0000 |
commit | cbb3f697245d7d57439cb5019e9f9834cb9cd35f (patch) | |
tree | 28a4bed2561336b33c7b14b73a4ea5c635202fb9 /vcl/source | |
parent | 908d058c67c4efb3dc142ea8d6ad59badf01c9c6 (diff) |
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/+/144104
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/button.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
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() ) |