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 <heiko.tietze@documentfoundation.org>
This commit is contained in:
Heiko Tietze
2025-10-07 11:41:16 +02:00
committed by Heiko Tietze
parent 12fa2f3cc4
commit e644ec9527
@@ -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);