New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Linux] Menubar background color is always white #13381
Comments
Making some tests, it looks like menubar is always taking the style from Adwaita theme. In fact, configuring gtk3 to "prefer dark" (see below), the menubar becomes black, following Adwaita-dark theme
|
This is probably due to https://github.com/electron/electron/blob/master/atom/browser/ui/views/menu_bar.cc#L127 where the menu bg color is fetched instead of the menubar bg color, which can be totally different depending on the used gtk3 theme. |
@Cobinja is right, the color returned is the GTK theme's menu background (changing that color in the theme changes the menu bar). I'm guessing Chromium defines only that color because it does not use a menu bar at all? So this might be problematic, because on quick glance I can't find an appropriate color id constant for the menu bar, nor is there any constant, that I can find, which would use the Is it possible to call Chromium's GetColor directly? |
@codebytere this looks great, thanks! |
Just tested and it works well: There is a tricky problem related to dark mode: when creating a window with the It's possible to 'fix' this as a user by forcing the dark theme variant for the process (e.g., by setting the This is already much improved, but ideally, we should take the |
@inukshuk if you'd be interested, i'd be happy to pair with you on a PR for this? I can try to address this later but also if you'd want to contribute i can also help that effort! |
@codebytere thanks for the offer, I'd very much like to contribute, if it makes sense. Now that macOS also has proper light and dark modes, I wonder if a common approach to this issue wouldn't be warranted? At the moment, there is only the Our app already has a light and dark theme; on macOS we're using a frameless window, but now there seems to be a new kind of highlight/shadow built into all windows: in light mode it is almost white, while in dark mode it is a little bit darker. Now, it seems to me as if Electron's frameless window always gets the light variant, even when the system preferences is switched to dark mode. See here for example: Here you see a few dark mode windows and the Electron window in the middle. Notice how the line at the top is much lighter than for the other windows; also the traffic lights are much lighter in the Electron window. I would argue that we probably need a |
@inukshuk let's not mix the issue of mojave dark mode support and GTK theming. Mojave dark mode has a different set of APIs and expectations to GTK theming. See this PR for what I'm doing to support Mojave dark mode: #14755 As for the white line you are seeing at the top of all your windows on mojave, see #13164 |
While the menubar background works now, its foreground color remains that of menu, not that of menubar. Should I open a new issue for that or can we handle it here? |
The issue that @Cobinja mentions is tracked here: Upstream issue: #15194
So this affects themes where the menu bar and context menu foreground color are different: Ubuntu 18.10 but not Ubuntu 18.04. |
Hi @codebytere coming back to your offer, I'm working on a fix for the most imminent issue #15194 (to avoid potentially illegible text). For this we also need to use |
I think I figured it out, please see #15878 |
This issue still exists in fedora 37 when using electron 21.3.0 |
Expected Behavior
I would expect the menubar's background color to use a background based on the GTK theme. Up to Electron 2.0 this used to work (albeit only for the light theme variant), see for example the screenshot below:
Actual behavior
In Electron 2.x and 3.x the menubar is always white. Using both the light and dark theme variant.
To Reproduce
This is reproducible for me with Electron Quick Start. Is it supposed to be this way or might this be caused by my Desktop configuration?
The text was updated successfully, but these errors were encountered: