cui/source/options/appearance.cxx | 3 +++ include/svtools/colorcfg.hxx | 1 + svtools/source/config/colorcfg.cxx | 13 +++++++++++++ 3 files changed, 17 insertions(+)
New commits: commit 02453612c8073fd0c35cef945bf6bf4912eee3ea Author: Sahil Gautam <[email protected]> AuthorDate: Fri Jan 30 07:46:59 2026 +0530 Commit: Sahil Gautam <[email protected]> CommitDate: Mon Feb 2 12:13:23 2026 +0100 fix: temporarily enable themes when the user changes appearance Application theming is disabled by default in `co-25.04` i.e. `LibreOfficeTheme` is set to 0 in registry. It's an expert setting in this version, so we can assume that most users aren't aware of it. When the user changes appearance mode from light to dark (or vice-versa), the appearance mode is changed at the toolkit level in the `UpdateDarkMode` implementations. After that the new system colors are loaded in the StyleSettings and any widget draw calls there after use these new appearance mode colors. The problem is that not all colors are replaced by new colors and this leads to unreadable/broken UI as the label and the button color become quite similar (dark or white). To fix this, we load the old appearance mode colors (one the user changed from) in the static `ThemeColors` object & then we temporarily enable application theming. Any widget draw calls from there on use the colors from the ThemeColors object (as theming was enabled) to draw the controls, see `drawThemedControl` in `salnativewidgets-luna.cxx`. Change-Id: I1848214b3de7cca3b785a0310698e79fb26f59f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198389 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Sahil Gautam <[email protected]> diff --git a/cui/source/options/appearance.cxx b/cui/source/options/appearance.cxx index 718603f8549a..9ef741212e47 100644 --- a/cui/source/options/appearance.cxx +++ b/cui/source/options/appearance.cxx @@ -145,8 +145,11 @@ void SvxAppearanceTabPage::LoadSchemeList() SvxAppearanceTabPage::~SvxAppearanceTabPage() { if (m_bRestartRequired) + { + pColorConfig->TemporarilyLoadAndEnableThemes(); ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(), GetFrameWeld(), svtools::RESTART_REASON_THEME_CHANGE); + } } std::unique_ptr<SfxTabPage> SvxAppearanceTabPage::Create(weld::Container* pPage, diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx index 70cd70a62353..506cdec27983 100644 --- a/include/svtools/colorcfg.hxx +++ b/include/svtools/colorcfg.hxx @@ -341,6 +341,7 @@ public: void ClearModified() {m_bModified = false;} bool IsModified() const {return m_bModified;} void Commit(); + void TemporarilyLoadAndEnableThemes(); void DisableBroadcast(); void EnableBroadcast(); diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 33246f73bf56..0e52bc75598d 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -875,6 +875,19 @@ void EditableColorConfig::Commit() m_bModified = false; } +void EditableColorConfig::TemporarilyLoadAndEnableThemes() +{ + if (!ThemeColors::IsThemeLoaded()) + { + // extension to registry + m_pImpl->Load(GetCurrentSchemeName()); + m_pImpl->CommitCurrentSchemeName(); + + // // registry to theme + ColorConfig::LoadThemeColorsFromRegistry(); + } +} + void EditableColorConfig::DisableBroadcast() { m_pImpl->BlockBroadcasts(true);
