LO can change UI and document background colors scheme in Tools-Options but it takes time. Especially for testers, it would be useful to have drop-down icons in toolbar to be able to change: 1. Tools > Options > LibreOffice > View 2. Tools > Options > LibreOffice > Appearance
This might be useful not only for testers, but for users as well. I'm not sure this command should be visible by default though. FTR this is not something that can be done via macro, because simply changing the value of the ApplicationAppearance entry won't automatically apply it. The actual code to apply the changes are in ColorConfig_Impl::Load, which is not accessible to macros.
Strong -1 from my side to expose these configuration switches in the primary UI. Nothing to say against making the life easier for QA but it's quite some work and could be done per macro.
FTR this is the macro that I created to change the Appearance option. It does change the appearance option in the registry, but it does not get applied until LO is restarted. Hence, AFAIK this cannot be achieved solely via macros. Sub ToggleDarkLight Dim oConfigProvider As Object Dim oConfigAccess As Object Dim pNode(0) As New com.sun.star.beans.PropertyValue oConfigProvider = createUnoService("com.sun.star.configuration.ConfigurationProvider") pNode(0).Name = "nodepath" pNode(0).Value = "org.openoffice.Office.Common/Misc" oConfigAccess = oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", pNode) Dim nCurValue As Integer nCurValue = oConfigAccess.ApplicationAppearance ' Values can be 0: Automatic; 1: Light; 2: Dark If nCurValue >= 2 Then oConfigAccess.ApplicationAppearance = 0 Else oConfigAccess.ApplicationAppearance = nCurValue + 1 End If oConfigAccess.CommitChanges() End Sub
We discussed the topic in the design meeting. The idea seems to be supported by the fact that MSO provides a mode switch, see https://support.microsoft.com/en-gb/office/dark-mode-in-word-e17b79a3-762f-4280-a81c-a15a859a693a The argument to not add rarely used functions to the primary UI, in particular not when the option is part of a user-defined list (color schemes can be added; dark/light change the value of Automatic) was rejected. So let's add the command.
There appears to be an existing uno command to do this. .uno:ChangeTheme (FN_CHANGE_THEME) and is often used in unit tests. sfx/sdi/sfx.sdi would need AccelConfig = TRUE, // keyboard shortcuts IIUC MenuConfig = TRUE, // Menu entry ToolBoxConfig = TRUE // can be added to toolbar and probably Toggle = TRUE as well as ReadOnlyDoc = TRUE FN_CHANGE_THEME already knows the GetCurrentSchemeName (maybe), and if it is auto (system), then MiscSettings::GetUseDarkMode() might indicate if the OS is asking for dark mode. MiscSettings::GetDarkMode() returns 0(system) 1(light) or 2(dark) from officecfg::Office::Common::Misc::Appearance and MiscSettings::SetDarkMode(0/1/2) triggers a redraw to the new mode. The options page managing the AppearanceStyle is cui/source/options/optdlg.cxx.
proposed at https://gerrit.libreoffice.org/c/core/+/166781
(In reply to Justin L from comment #5) > options page managing the AppearanceStyle is cui/source/options/optgdlg.cxx The UI theme is hidden on the config page except for certain VCLs const bool bHasDarkMode = sToolKitName.startsWith("gtk") || sToolKitName == "osx" || sToolKitName == "win"; if (!bHasDarkMode) m_xDarkModeFrame->hide();
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/da86bfd89e529e787da0bbb3e3150c1f5d4e0dfd tdf#160349: add .uno:ChangeTheme to notebookbar to toggle dark mode It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Thanks Justin, works nice for me. In Options > LibreOffice > View > Appearance change would not be accepted with Apply, only OK, so it used to take more time. Can you please explain something: in the same menu, there is also System mode, which in my GTK sets Light appearance although I have Dark system. I assume that this toggle switches Light-Dark? But when I set Light and open Options, it says System.
(In reply to Timur from comment #9) > I assume that this toggle switches Light-Dark? But when I set Light and open > Options, it says System. I found that "Application colors - scheme - automatic = system settings" takes its cue from "View - appearance - mode", and so (at least for gtk and I assume win/osx) it can always stay on "System Theme". For gen/kf* it will toggle between dark and system theme.
Hmm, I don't think I answered your question though. You are saying that your GTK OS system is dark mode, but LibreOffice equates "System" with Light. I wouldn't know about that.
The toggle switches between "system" and non-system actually.
I'm not clear how, but in my Linux Mint Cinnamon GTK3 this icon works reliably, while Options does not, I assume that would be bug 153841.
Added the UNO command to the release notes: https://wiki.documentfoundation.org/index.php?title=ReleaseNotes%2F24.8&type=revision&diff=750277&oldid=750142