How to change icon-theme when the system switches to dark/light?

Hi!
I use LibreOffice on Linux, and I am a big user or dark/light theme switcher.
I do not have any issue about the global theme of LibreOffice which automatically switches with the system, however it is not the case for the icons.

When I switch to dark theme, since the icon-theme do not switch too, it is very difficult to see them since most of them are black on a dark background.

I know Ubuntu found a trick with the Yaru icon-theme for LibreOffice being dark with a white outline, but I’m not fond of the Yaru icons.

I’ve found two icon-themes available through two extensions that both provide a light and a dark version of the icons :
https://github.com/rizmut/libreoffice-style-breeze
idem/libreoffice-style-colibre

But I can only change them manually.

I have therefore two questions :
1. Is there a way to automatically change the icon set? I could make a script to change the icon-theme of LibreOffice when I switch to dark/light theme, but… I don’t know how to change the icon-theme other than via the LO options, so via the graphical interface. Is there a command to change this setting?

2. If you do not know or if it is not possible to change the icon-theme automatically or through the command line : maybe you can suggest me another icon theme that would have found the same trick as the Yaru icon-theme for LibreOffice?

I want to change the default automatic icon theme to my liking as well, as I don’t like the preset default on Linux (Elementary on light them, and Sifr on dark theme).

The only solution to this issue, as I am switching between light and dark themes a lot, is to use the Yaru theme. It’s better than both Elementary and Sifr. But I would prefer Colibre icons.

I think this bug report is working towards the solution you want, Bug 148764 - Icon themes need to include metadata and different variants in one package

Was patched to your current icons in tdf#127138

1 Like
' Change Icon Theme to "Breeze"
Sub ChangeIconTheme
    Dim keyNode As Object, oDriver As Object
    With GlobalScope.Basiclibraries
        If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
    End With
    keyNode = Tools.Misc.GetRegistryKeyContent("org.openoffice.Office.Common/Misc", True)
     
    KeyNode.SymbolStyle="breeze"     ' Breeze style  
    ' KeyNode.SymbolStyle="auto"     ' Automatic style
    
    keyNode.commitChanges    
End Sub
2 Likes

This helped, thanks. I’ll leave some modified code here that toggles between Breeze Dark and Breeze, so switching can be bound to a hotkey.

' Toggle between Breeze and Breeze Dark Icon Theme
Sub ToggleIconTheme
    Dim keyNode As Object
    Dim currentTheme As String
    
    ' Load Tools library if not already loaded
    With GlobalScope.Basiclibraries
        If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
    End With
    
    ' Get the registry key for the icon theme settings
    keyNode = Tools.Misc.GetRegistryKeyContent("org.openoffice.Office.Common/Misc", True)
    
    ' Get the current icon theme
    currentTheme = keyNode.SymbolStyle
    
    ' Toggle between "breeze" and "breeze_dark"
    If currentTheme = "breeze" Then
        keyNode.SymbolStyle = "breeze_dark"
    ElseIf currentTheme = "breeze_dark" Then
        keyNode.SymbolStyle = "breeze"
    Else
        ' Set to "breeze" if the current theme is neither breeze nor breeze_dark
        keyNode.SymbolStyle = "breeze"
    End If
    
    ' Commit the changes to apply the new icon theme
    keyNode.commitChanges
End Sub