From e644ec9527e5bcc8ce9f30c9d57e810e02e2d2f3 Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Tue, 7 Oct 2025 10:25:24 +0200 Subject: [PATCH] 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 --- svx/source/styles/CommonStylePreviewRenderer.cxx | 7 +++++++ 1 file changed, 7 insertions(+) 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);