svx/source/styles/CommonStylePreviewRenderer.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit e644ec9527e5bcc8ce9f30c9d57e810e02e2d2f3
Author:     Heiko Tietze <[email protected]>
AuthorDate: Tue Oct 7 10:25:24 2025 +0200
Commit:     Heiko Tietze <[email protected]>
CommitDate: Tue Oct 7 11:41:16 2025 +0200

    Resolves tdf#168712 - Make style preview aware of highlight and area color
    
    If area or highlight color is set, the preview should calculate the
    effective automatic font color as white or black depending on whether
    this color isDark()
    
    Change-Id: I6c821724ecf313e2100e0fdccabfcdaf015c529e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192006
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <[email protected]>

diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx 
b/svx/source/styles/CommonStylePreviewRenderer.cxx
index e26cc5575620..a3163ff4931b 100644
--- a/svx/source/styles/CommonStylePreviewRenderer.cxx
+++ b/svx/source/styles/CommonStylePreviewRenderer.cxx
@@ -373,6 +373,13 @@ bool CommonStylePreviewRenderer::render(const 
tools::Rectangle& aRectangle, Rend
 
         if (maFontColor != COL_AUTO)
             mrOutputDev.SetTextColor(maFontColor);
+        else
+        {
+            if (maBackgroundColor != COL_AUTO)
+               mrOutputDev.SetTextColor(maBackgroundColor.IsDark() ? COL_WHITE 
: COL_BLACK);
+            else if (maHighlightColor != COL_AUTO)
+               mrOutputDev.SetTextColor(maHighlightColor.IsDark() ? COL_WHITE 
: COL_BLACK);
+        }
 
         if (maHighlightColor != COL_AUTO)
             mrOutputDev.SetTextFillColor(maHighlightColor);

Reply via email to