cui/source/tabpages/numfmt.cxx | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
New commits: commit bbf1d7faca7912016855b51a10c93a064675e213 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Jan 17 12:15:22 2023 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Jan 17 17:12:18 2023 +0000 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 <caol...@redhat.com> 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();