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 <heiko.tietze@documentfoundation.org>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 4c9fbbc..b7d61ce 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));