summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-01-17 12:15:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2023-01-17 17:12:18 +0000
commitbbf1d7faca7912016855b51a10c93a064675e213 (patch)
tree396ae6e0985d2ac3d6d3aba9b0a9ef74b9bc1bb1 /cui
parentc7ac513a8217179c5fae774363e8b0b1f41cea5c (diff)
tdf#152637 format cells example text black on dark background
with application colors, scheme: LibreOffice Dark enabled Change-Id: I56ac48ec2e6afd77f20a8581c6d872942618d802 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145667 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/tabpages/numfmt.cxx24
1 files changed, 19 insertions, 5 deletions
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index ea52910f9fd1..e6e669de6422 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -111,9 +111,19 @@ void SvxNumberPreview::NotifyChange( const OUString& rPrevStr,
mnPos = -1;
}
}
- svtools::ColorConfig aColorConfig;
- Color aWindowTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
- aPrevCol = pColor ? *pColor : aWindowTextColor;
+ if (pColor)
+ aPrevCol = *pColor;
+ else
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aFgColor = aColorConfig.GetColorValue(svtools::FONTCOLOR, false).nColor;
+ if (aFgColor == COL_AUTO)
+ {
+ Color aBgColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
+ aFgColor = aBgColor.IsDark() ? COL_WHITE : COL_BLACK;
+ }
+ aPrevCol = aFgColor;
+ }
Invalidate();
}
@@ -133,8 +143,12 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::
rRenderContext.Push(vcl::PushFlags::ALL);
svtools::ColorConfig aColorConfig;
- rRenderContext.SetTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
- rRenderContext.SetBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
+ Color aBgColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
+ Color aFgColor = aColorConfig.GetColorValue(svtools::FONTCOLOR, false).nColor;
+ if (aFgColor == COL_AUTO)
+ aFgColor = aBgColor.IsDark() ? COL_WHITE : COL_BLACK;
+ rRenderContext.SetBackground(aBgColor);
+ rRenderContext.SetTextColor(aFgColor);
rRenderContext.Erase();
vcl::Font aDrawFont = rRenderContext.GetFont();