sc/source/ui/cctrl/dpcontrol.cxx |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 750393ef151fed5eceb9d482975f4819d449666e
Author:     Rafael Lima <[email protected]>
AuthorDate: Wed Nov 2 21:31:39 2022 +0200
Commit:     Rafael Lima <[email protected]>
CommitDate: Wed Nov 30 18:02:43 2022 +0100

    tdf#151702 Improve contrast of down arrow of AutoFilter in dark mode
    
    When using dark mode, the down arrow of the Autofilter has a hardcoded 
black line color.
    
    This patch tests whether the button is dark and uses a lighter color to 
improve the contrast with the dark background.
    
    Change-Id: I48d99262f8df34f2cc90f39e5aafa5c6cf83e2b2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142150
    Tested-by: Jenkins
    Tested-by: Heiko Tietze <[email protected]>
    Reviewed-by: Heiko Tietze <[email protected]>

diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 4c9fbbc6abb3..b7d61ce002c7 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -26,6 +26,7 @@
 #include <document.hxx>
 #include <docpool.hxx>
 #include <patattr.hxx>
+#include <svtools/colorcfg.hxx>
 
 ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* 
pStyle, const Fraction* pZoomY, ScDocument* pDoc) :
     mpDoc(pDoc),
@@ -181,11 +182,19 @@ void ScDPFieldButton::drawPopupButton()
 
     float fScaleFactor = mpOutDev->GetDPIScaleFactor();
 
-    // Background & outer black border
-    mpOutDev->SetLineColor(COL_BLACK);
+    // Button background color
+    Color aFaceColor = mpStyle->GetFaceColor();
     Color aBackgroundColor
         = mbHasHiddenMember ? mpStyle->GetHighlightColor()
-                            : mbPopupPressed ? mpStyle->GetShadowColor() : 
mpStyle->GetFaceColor();
+                            : mbPopupPressed ? mpStyle->GetShadowColor() : 
aFaceColor;
+
+    // Button line color
+    mpOutDev->SetLineColor(mpStyle->GetLabelTextColor());
+    // If the document background is light and face color is dark, use 
ShadowColor instead
+    Color aDocColor = 
svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
+    if (aDocColor.IsBright() && aFaceColor.IsDark())
+        mpOutDev->SetLineColor(mpStyle->GetShadowColor());
+
     mpOutDev->SetFillColor(aBackgroundColor);
     mpOutDev->DrawRect(tools::Rectangle(aPos, aSize));
 

Reply via email to