Bug 147614 - LibreOffice icons theme autodetect does not respect system theme
Summary: LibreOffice icons theme autodetect does not respect system theme
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
(earliest affected) release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL: https://store.kde.org/p/1166289/
Depends on:
Blocks: Icon-Themes
  Show dependency treegraph
Reported: 2022-02-23 16:00 UTC by Martin
Modified: 2022-06-18 17:50 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:

dark theme light icons (19.61 KB, image/png)
2022-02-23 16:00 UTC, Martin
breeze (dark) (18.11 KB, image/png)
2022-02-24 08:26 UTC, Martin

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2022-02-23 16:00:41 UTC
Created attachment 178484 [details]
dark theme light icons

Operating System: Arch Linux
KDE Plasma Version: 5.24.2
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Kernel Version: 5.16.10-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2

LO does not respect system theme, if I set global theme to Breeze Dark, Autodetect for icons (Options->LibreOffice->View->Icon style) correctly detects style as Breeze (dark), but if I change the Icons theme in Plasma settings to anything else, for example Papirus or Papirus-Dark, LO will now incorrectly assume Breeze theme(not dark).

This results in a bad OOB experience, as can be seen in the attachment, where LO is using dark theme against icons that were made for a light theme(so dark icons).

Maybe using org.freedesktop.appearance.color-scheme value and setting the icon theme accordingly could be a better approach? https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/
Comment 1 Heiko Tietze 2022-02-24 08:22:34 UTC
We do follow the system theme (and operating system) for the automatic icon theme selection. On Windows it is "Colibre", for Plasma5 (KDE) and LXQt "Breeze", Gnome, Mate, Unity use "Elementary", and macOS "Sukapura". We also correctly detect whether Breeze (light) or Breeze dark is configured and pick the default icon theme accordingly.

However, the LibreOffice icon themes define some thousands of additional icons that are not part of the system's icon theme. All icons are hand-crafted by volunteers to match the system theme as best as possible but are not officially part of it. And we just do not have Papirus available.

=> NAB

By the way, some icon themes are not shipped by default but can be installed per extension, for example Yaru matches well Ubuntu. Take a look at https://extensions.libreoffice.org/?Tags%5B%5D=109. 

And of course you are very welcome to create and share a Papirus theme for LibreOffice.
Comment 2 Martin 2022-02-24 08:26:35 UTC
Created attachment 178500 [details]
breeze (dark)

I do not think that is the case, the icons are there and work fine, even when Papirus is selected by the system, the autodetect just does not work.

Here is a screenshot of Breeze (dark) when manually selected.

Icons work fine, it's just the autodetect that is broken.
Comment 3 Heiko Tietze 2022-02-24 08:37:14 UTC
True, "Breeze dark" is chosen as matching to the icon not the desktop theme. If you rename it to Papirus is would be the default in your case. 

In other words: if an installed LibreOffice icon theme name matches the system icon theme this will be used. Otherwise the desktop theme decides about the default.
Comment 4 Martin 2022-02-24 09:04:25 UTC
In that case, if the system theme is dark, and the icon theme is unsupported(Papirus), shouldn't LO default to a dark icon theme?
Comment 5 Heiko Tietze 2022-02-24 09:51:45 UTC
We don't check whether the system theme is dark. And even in this case we only have Breeze and Sifr in dark variants.

Rizal, what's your take on this?
Comment 6 Rizal Muttaqin 2022-02-24 14:46:22 UTC
(In reply to Heiko Tietze from comment #5)
> We don't check whether the system theme is dark. And even in this case we
> only have Breeze and Sifr in dark variants.
> Rizal, what's your take on this?

I support the idea of system wide dark detection, but currently there are many hindrances here since LibreOffice is a multiplatform/multi-OS application. How LibreOffice with its VCL library could integrate with Windows/macOS/Linux/FreeDesktop system wide dark mode? If the solution has been already there so we can talk further about supporting icon theme dark/light variant in many OSes.
That's why some icon themes does not have dark variant.

But to be honest, current dark detection implementation is broken (or at least in my setup). The icon theme does not change automatically when I choose dark theme in my KDE desktop with Breeze, the icon then did not change to Breeze dark, even after restarting the application. Even under Safe Mode. User expect seamless experience.

Version: / LibreOffice Community
Build ID: c993d9e7538ffad8b31b26774d7062ee85572e48
CPU threads: 8; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: id-ID (id_ID.UTF-8); UI: id-ID
Calc: threaded
Comment 7 Heiko Tietze 2022-02-24 14:57:05 UTC
(In reply to Rizal Muttaqin from comment #6)
> But to be honest, current dark detection implementation is broken...

Bug 127138 "Breeze dark system theme should enable Breeze dark icons" is about this. Works for me (and as commented before, the icons follow the theme _name_ otherwise the desktop default with Plasma5 = Breeze).

Then we have bug 124966 "svg icon theme color scheme support" with the idea to invert the icon colors (or identify the color to invert) so a theme works on both bright and dark themes.