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();