Bug 493550 - Breeze doesn't allow "menubar color customization by setting cusotm QPalette" anymore
Summary: Breeze doesn't allow "menubar color customization by setting cusotm QPalette"...
Status: REPORTED
Alias: None
Product: Breeze
Classification: Plasma
Component: QStyle (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-09-23 20:32 UTC by Sahil Gautam
Modified: 2024-09-25 15:29 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sahil Gautam 2024-09-23 20:32:19 UTC
Hi, I am Sahil Gautam, an active LibreOffice contributor, and a student. This summer I worked on a GSoC project which
was about enabling UI color customization in LibreOffice. As a part of it, I wrote some part in the core which managed the colors, and some code in the VCL_PLUGINs (like Qt and GTK) where I use the colors, essentially putting them into the
widget toolkits.

Everything worked fine, but around the end of august I noticed that the menubar doesn't respond to the custom colors
anymore, and the story has been the same ever since. I realized it quite late that it has something to do with the theme,
and not my code. I concluded this because on changing to different different themes, I could see some parts of customization showing up, and some not. I tried building breeze from source, but couldn't, as it wasn't as simple as `kdesrc-build breeze` or using cmake.

Here are some useful links:
[Customization Patch]: https://gerrit.libreoffice.org/c/core/+/168901
[Project Report]: https://printfdebugging.in/libreoffice_themes_final_report_gsoc_24.html

STEPS TO REPRODUCE
1. Setup libreoffice-dev,  https://wiki.documentfoundation.org/Development/GetInvolved
2. Cherry-pick the patches in the hierarchy. (Part 1 then Part 3)
3.  Build and then try to change menubar colors from menubar > tools > options > application colors.

OBSERVED RESULT
Menubar doesn't show  the custom palette's colors, and instead uses the desktop environment's theme's style. This 
applies to all the customizations like the background color, the highlight color, the text color, the highlight text color etc.
Some themes allow some of these.

EXPECTED RESULT
The menubar should respect the custom settings and show the colors accordingly. I expect setting a custom palette to 
work without any workarounds.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2
Kernel Version: 6.10.10-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 32 × AMD Ryzen 9 7950X 16-Core Processor
Memory: 54.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7D73
System Version: 1.0
Comment 1 Sahil Gautam 2024-09-23 20:36:44 UTC
```
QPalette QtCustomStyle::GetMenuBarPalette()
{
    if (StyleSettings::GetThemeState() == ThemeState::NOT_LOADED
        || QApplication::palette() != QtCustomStyle::customPalette())
        return QApplication::palette();

    QPalette aPal;
    const ThemeColors& aThemeColors = StyleSettings::GetThemeColors();

    aPal.setColor(QPalette::Text, toQColor(aThemeColors.GetMenuBarTextColor()));
    aPal.setColor(QPalette::ButtonText, toQColor(aThemeColors.GetMenuBarTextColor()));
    aPal.setColor(QPalette::Window, toQColor(aThemeColors.GetMenuBarColor()));
    aPal.setColor(QPalette::Highlight, toQColor(aThemeColors.GetMenuBarHighlightColor()));
    aPal.setColor(QPalette::HighlightedText, toQColor(aThemeColors.GetMenuBarHighlightTextColor()));

    return aPal;
}
```

```
    if (mpQMenuBar && StyleSettings::GetThemeState() != ThemeState::NOT_LOADED)
        mpQMenuBar->setPalette(QtCustomStyle::GetMenuBarPalette());
```
This is basically it. If the theme is loaded (the feature is not disabled), then create a custom palette ...
Comment 2 Nate Graham 2024-09-24 03:35:36 UTC
Is the active color scheme "Breeze Light" or "Breeze Dark", or is it "Breeze Classic"? Because titlebars colors only take effect when using Breeze Classic or another similar color scheme that doesn't have header colors in it.
Comment 3 Sahil Gautam 2024-09-25 09:20:54 UTC
(In reply to Nate Graham from comment #2)
> Is the active color scheme "Breeze Light" or "Breeze Dark", or is it "Breeze
> Classic"? Because titlebars colors only take effect when using Breeze
> Classic or another similar color scheme that doesn't have header colors in
> it.

The active color scheme is breeze (the one which comes as default with plasma. I see two options when I open system settings in plasma kde, on the left the light, and on the right dark variant of breeze). It's not about titlebars, but about the menubar (QMenuBar).