summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2022-11-02 21:31:39 +0200
committerRafael Lima <rafael.palma.lima@gmail.com>2022-11-30 18:02:43 +0100
commit750393ef151fed5eceb9d482975f4819d449666e (patch)
tree979793c491e4bf3544b9f145bbd0490106d8bd0e /sc
parent83485052e6cac574754191c59371dbc41383b810 (diff)
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>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/cctrl/dpcontrol.cxx15
1 files changed, 12 insertions, 3 deletions
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));