sc/source/ui/unoobj/docuno.cxx | 11 +++++++++-- sd/source/ui/unoidl/unomodel.cxx | 10 ++++++++-- svtools/source/config/colorcfg.cxx | 4 ++-- sw/qa/extras/tiledrendering/tiledrendering.cxx | 8 +++++++- sw/source/uibase/uno/unotxdoc.cxx | 10 ++++++++-- 5 files changed, 34 insertions(+), 9 deletions(-)
New commits: commit f401c1dcf70c77d86cd2f3cd34174318d1120b20 Author: Sahil Gautam <[email protected]> AuthorDate: Tue Mar 18 16:51:03 2025 +0530 Commit: Sahil Gautam <[email protected]> CommitDate: Mon Jan 26 09:54:48 2026 +0100 tdf#165803 use COL_WHITE for DOCCOLOR for both light and dark modes LibreOffice since 1995 has used light as the default background color for slides and documents. 'LibreOffice Themes' broke this behaviour as it depends on the hardcoded color values for the document colors. if the desktop environment is in dark mode, a dark document color is used. this causes issues for the slides created pre themes as they were created with white slide background. issues like black text on black background. this is also concerning because DOCCOLOR is not saved with the document, so if someone creates slides/documents with DOCCOLOR in mind, they would be disappointed to see the difference. so the simplest solution to this problem would be to use white color for both light and dark modes. since we would be using COL_WHITE for DOCCOLOR after this patch, it would be best change CALCGRID as well, to use a lighter shade of grey in dark mode (which would match the document color changes) changing DOCCOLOR value to COL_WHITE for dark mode broke a sd_tiledrendering test it was using the DOCCOLOR to check if dark or light theme is being used. commented that test out for now (just for this patch). reworking themes ui and implementation details to simplify the feature. Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183071 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <[email protected]> Reviewed-by: Sahil Gautam <[email protected]> (cherry picked from commit ddfce993c3d833171b92980476b11c985fb7693d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198089 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Sahil Gautam <[email protected]> diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 3a7545db4f60..a72ff7acd2f7 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -513,8 +513,15 @@ static OString getTabViewRenderState(ScTabViewShell& rTabViewShell) if (rTabViewShell.IsAutoSpell()) aState.append('S'); - if (rViewRenderingOptions.GetDocColor() == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) - aState.append('D'); + + // NOTE: DOCCOLOR:dark was changed to COL_WHITE for 25.2.2, please read tdf#165803 for the reasons. + // TODO: Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 (this patch) is a temporary fix for 25.2.2. + // looking for/working towards better solutions. + // + // document color canot be used to determine which theme is being used (light/dark), as they both use white + // document background color. + // if (rViewRenderingOptions.GetDocColor() == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) + // aState.append('D'); aState.append(';'); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 3153b61c0b67..0a94925e256e 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -3974,8 +3974,14 @@ OString SdXImpressDocument::getViewRenderState(SfxViewShell* pViewShell) const SdViewOptions& pVOpt = pView->GetViewOptions(); if (mpDoc && mpDoc->GetOnlineSpell()) aState.append('S'); - if (pVOpt.mnDocBackgroundColor == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) - aState.append('D'); + // NOTE: DOCCOLOR:dark was changed to COL_WHITE for 25.2.2, please read tdf#165803 for the reasons. + // TODO: Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 (this patch) is a temporary fix for 25.2.2. + // looking for/working towards better solutions + // + // document color canot be used to determine which theme is being used (light/dark), as they both use white + // document background color. + // if (pVOpt.mnDocBackgroundColor == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) + // aState.append('D'); aState.append(';'); OString aThemeName = OUStringToOString(pVOpt.msColorSchemeName, RTL_TEXTENCODING_UTF8); diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index c49a33f65426..df6ccfb47c6f 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -619,7 +619,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry, int nMod) static const Color cAutoColors[][nColorTypes] = { - { COL_WHITE, Color(0x1C1C1C) }, // DOCCOLOR + { COL_WHITE, COL_WHITE }, // DOCCOLOR { COL_LIGHTGRAY, Color(0x808080) }, // DOCBOUNDARIES { Color(0xDFDFDE), Color(0x333333) }, // APPBACKGROUND { COL_LIGHTGRAY, Color(0x808080) }, // TABLEBOUNDARIES @@ -643,7 +643,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry, int nMod) { COL_LIGHTGREEN, COL_LIGHTGREEN }, // HTMLCOMMENT { COL_LIGHTRED, COL_LIGHTRED }, // HTMLKEYWORD { COL_GRAY, COL_GRAY }, // HTMLUNKNOWN - { COL_GRAY3, COL_GRAY7 }, // CALCGRID + { COL_GRAY3, COL_GRAY3 }, // CALCGRID { COL_LIGHTBLUE, COL_LIGHTBLUE }, // CALCCELLFOCUS { COL_LIGHTGRAYBLUE, COL_LIGHTGRAYBLUE }, // CALCDBFOCUS { COL_BLUE, COL_BLUE }, // CALCPAGEBREAK diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 35a84bdb3d7f..71baeb99bb7e 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1394,7 +1394,13 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testThemeViewSeparation) // Test that changing the theme in one view doesn't change it in the other view CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testInvertBackgroundViewSeparation) { - Color aDarkColor(0x1c, 0x1c, 0x1c); + // NOTE: DOCCOLOR:dark was changed to COL_WHITE for 25.2.2, please read tdf#165803 for the reasons. + // TODO: Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 (this patch) is a temporary fix for 25.2.2. + // looking for/working towards better solutions + // + // document color canot be used to determine which theme is being used (light/dark), as they both use white + // document background color. + Color aDarkColor(COL_WHITE); addDarkLightThemes(aDarkColor, COL_WHITE); SwXTextDocument* pXTextDocument = createDoc(); int nFirstViewId = SfxLokHelper::getCurrentView(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 4ce2e4d87a3b..b64ff29aa3a8 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3629,8 +3629,14 @@ OString SwXTextDocument::getViewRenderState(SfxViewShell* pViewShell) aState.append('P'); if (pVOpt->IsOnlineSpell()) aState.append('S'); - if (pVOpt->GetDocColor() == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) - aState.append('D'); + // NOTE: DOCCOLOR:dark was changed to COL_WHITE for 25.2.2, please read tdf#165803 for the reasons. + // TODO: Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 (this patch) is a temporary fix for 25.2.2. + // looking for/working towards better solutions. + // + // document color canot be used to determine which theme is being used (light/dark), as they both use white + // document background color. + // if (pVOpt->GetDocColor() == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) + // aState.append('D'); if (pView->IsSpotlightParaStyles() || pView->IsSpotlightCharStyles()) {
