Go to Tools > Macros > Organize Macros > Basic... > My Macros.
Click New to create a macro.
Copy all contents in libreoffice-theme.bas
to the new macro file and save it.
Go to Tools > Options > Personalization.
On Linux systems, it is recommended to use the Default look to allow the system to handle the theme automatically. The benefit is that all GUI elements will be themed, as opposed to Preinstalled themes, and changes are reflected immediately.
When using either UpdateTheme()
or UpdateThemeAndScheme()
, the macro will only toggle between the Default theme and the Dark theme. These options are mostly useful on Windows since LibreOffice does not yet detect the system theme and change its theme automatically.
Go to Tools > Options > Applications Colors.
Create a new colour scheme called LibreOffice Dark and customize it according to your preferences. Setting Document background to black or a dark grey is usually enough.
Ensure the light colour scheme remains named as LibreOffice.
Go to Tools > Customize > Keyboard.
Select a function under Category > LibreOffice Macros > My Macros > (path to saved macro).
Functions:
UpdateThemeAndScheme
- change both the LibreOffice theme and document colour scheme.UpdateTheme
- only change the LibreOffice theme.UpdateScheme
- only change the document colour scheme.
Select a shortcut key and click Modify to assign it to a function.
Use your previously assigned shortcut key to manually toggle the theme and/or colour scheme.
Themes and colour schemes can be changed from the command line, which can be useful for automating when a specific theme should activate.
Toggle theme and colour scheme:
soffice --invisible "macro:///<Library>.<Module>.UpdateThemeAndScheme()"
Set dark theme and colour scheme:
soffice --invisible "macro:///<Library>.<Module>.UpdateThemeAndScheme(dark)"
Set light theme and colour scheme:
soffice --invisible "macro:///<Library>.<Module>.UpdateThemeAndScheme(light)"
Toggle theme:
soffice --invisible "macro:///<Library>.<Module>.UpdateTheme()"
Set dark theme:
soffice --invisible "macro:///<Library>.<Module>.UpdateTheme(dark)"
Set light theme:
soffice --invisible "macro:///<Library>.<Module>.UpdateTheme(light)"
Toggle colour scheme:
soffice --invisible "macro:///<Library>.<Module>.UpdateScheme()"
Set dark colour scheme:
soffice --invisible "macro:///<Library>.<Module>.UpdateScheme(dark)"
Set light colour scheme:
soffice --invisible "macro:///<Library>.<Module>.UpdateScheme(light)"
Note: Windows users should prepend soffice
with the path C:\Program Files\LibreOffice\program\
or add it to the Path
environment variable.
- Changing the LibreOffice theme does not get reflected immediately so you have to either minimize the window and restore it or resize it to see the changes.
- Exporting from Google Docs to a
.odt
or.docx
file will set the page background colour to White and the dark colour scheme will have no effect, so you have to change Background to None under Page > Styles. This is not required when creating new documents from within LibreOffice or Microsoft Office.
Thank you very much! you have made my day. No need to change LibreOffice theme in my case cause it is dark all the time in my KDE Plasma setting, but changing colour scheme just hitting a keyboard shortcut is very useful. Thanks very much for this work!