Skip to content
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] Brave does not respect system light/dark theme #14685

Closed
matfantinel opened this issue Mar 12, 2021 · 63 comments · Fixed by brave/brave-core#21065
Closed

[Linux] Brave does not respect system light/dark theme #14685

matfantinel opened this issue Mar 12, 2021 · 63 comments · Fixed by brave/brave-core#21065

Comments

@matfantinel
Copy link

matfantinel commented Mar 12, 2021

Description

On a Linux system, Brave has its own controls for light/dark mode, but it does not respect the system's overall theme. If the option to use the "Gtk" theme is chosen, the Brave UI does respect the dark mode, however it doesn't set the prefers-color-scheme media query. This is a bug inherited from Chromium, and is being tracked here: https://bugs.chromium.org/p/chromium/issues/detail?id=998903

I know this should be fixed upstream, but Google doesn't seem to care about it enough to justify the effort. One of the latest comments mentions a patch that a user has made, which solves the issue. The patch can be seen here in case a similar solution is intended.

Steps to Reproduce

  1. Open Brave on a Linux system with light theme enabled
  2. Open a website that supports prefers-color-scheme query, such as DuckDuckGo
  3. Change system theme to dark mode
  4. Website does not change theme

Actual result:

This is how Brave and other Chromium browsers behave (left), and how Firefox does (right). Note how in Chromium, the page content doesn't change
before

Expected result:

Brave/Chromium (left), Firefox (right)

after

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Brave 1.21.74 Chromium: 89.0.4389.72 (Official Build) (64-bit)
Revision 3f345f156bfd157bd1bea06310e55f3fb2490359-refs/branch-heads/4389@{#1393}
OS Linux

Version/Channel Information:

  • Can you reproduce this issue with the current release? Yes
  • Can you reproduce this issue with the beta channel? Yes
  • Can you reproduce this issue with the nightly channel? Haven't tried, but no reason to believe it doesn't happen there

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields? Not related
  • Does the issue resolve itself when disabling Brave Rewards? Not related
  • Is the issue reproducible on the latest version of Chrome? Yes

Miscellaneous Information:

Latest versions of Ubuntu have a quick Light/Dark mode toggle so it should be really easy to test

@rebron rebron added OS/Linux feature/themes Chromium/reported upstream Issue has been reported upstream and crbug link is in the issue labels Mar 12, 2021
@NumDeP
Copy link

NumDeP commented Mar 14, 2021

It works alright for me on openSuse, with 'GTK+' and 'Classic'.

@matfantinel
Copy link
Author

It works alright for me on openSuse, with 'GTK+' and 'Classic'.

Would you mind sharing what DE and themes you are using?

@NumDeP
Copy link

NumDeP commented Mar 14, 2021

DE - Tumbleweed, Colours - Dark, Theme - Classic

I don't know why you mentioned themes in the plural but I did used to have it on Breeze Dark and I think the system naturally changes this for the browser and naturally the sites follow if they have the dark viewing feature, though I'm not to sure.

@matfantinel
Copy link
Author

matfantinel commented Mar 14, 2021

@NumDeP hmm I assume the DE is KDE Plasma, Tumbleweed being the distro.

Maybe this detection works on KDE then? I tested on both GNOME (Ubuntu, PopOS) and Pantheon (elementary OS) and this detection didn't work sadly

@rebron rebron added this to Needs Info/Waiting Upstream in General Mar 16, 2021
@jmbuhr
Copy link

jmbuhr commented Apr 6, 2021

I can confirm this issue on my system (pop-os / ubuntu). While you can set the theme to GTK+, which matches the system theme for the window and titlebar, the actual brave colors only have the options Light and Dark and not match system theme as available on windows and MacOS.
image

@rebron rebron added the Chromium/waiting upstream Issue is in Chromium; we'll likely wait for the fix label May 14, 2021
@MinmoTech
Copy link

Would it be possible to change the theme on the command line with a script?
You could then use something like darkman

@dima2306
Copy link

dima2306 commented Sep 3, 2021

The same is on Fedora34/Cinnamon DE. If I have a classic theme in brave nothing changes when switching to the dark mode. When used GTK+ only the window changes. Is there any chance to respect system preferences? Firefox handles this well.

@harpreetsb
Copy link

this is a very annoying bug, hope they fix it soon

@wknapik
Copy link
Contributor

wknapik commented Sep 27, 2021

Works for me on a fresh profile (brave --user-data-dir="$(mktemp -d)"&) with the Brave colors: Dark setting on up-to-date Arch Linux running Brave Browser 93.1.29.81 via brave-bin 1:1.29.81-1.

Keep in mind that after recent privacy improvements the setting Trackers & ads blocked (aggressive) will prevent the dark theme from being requested from the site.

@esjarc
Copy link

esjarc commented Sep 28, 2021

@wknapik The issue was supposed to be about Brave not following the system's theme setting. It is working correctly when manually switching between light and dark theme in Brave's settings.

Some people use tools to automatically change the system theme depending on the time of day. Brave/Chromium is one of the few applications left not following this choice. Firefox on all operating systems and Chromium browsers on Android/macOS/Windows already support this functionality.

There's also an upstream (Chromium) issue about this. GNOME (libadwaita) is in the process of implementing an official system-wide dark mode. Maybe it would make sense to implement the functionality in Brave by utilizing the upcoming preference in GNOME 42 (not sure about how this will work with KDE/Qt)?

@wknapik
Copy link
Contributor

wknapik commented Sep 28, 2021

@esjarc ah, I see. So this is about adding the match system theme option on Linux?

@esjarc
Copy link

esjarc commented Sep 28, 2021

@wknapik Exactly! (Brave is currently only offering a dark and a light theme, but no option to follow the system theme on Linux.)

@wknapik
Copy link
Contributor

wknapik commented Sep 29, 2021

@esjarc judging from the Chromium/waiting upstream label on this issue, we'll have to wait for an upstream fix.

@ghost
Copy link

ghost commented Jan 1, 2022

@esjarc judging from the Chromium/waiting upstream label on this issue, we'll have to wait for an upstream fix.

That's their own fault then for switching from Muon and putting an Achilles heel into this product. DDG broswer right around the corner. And LibreWolf is a thing as well.

@satrinity402
Copy link

Still an issue for me. Running Pop OS 21.10

@hasufell
Copy link

Yeah, end users don't care how you maintain your browser, what libraries etc. you use. They care about the end product. If you don't have the manpower/knowledge to maintain a fork or contribute patches upstream, then that seems like a problematic situation. This reminds me of the Tor projects firefox fork.

@macdabby
Copy link

still broken for me also, debian bookworm with gnome 42

@GNUKalashnikov
Copy link

Still Broken for me, Arch Linux, Gnome 42.3, Running Wayland

@faloi
Copy link

faloi commented Oct 4, 2022

Still broken for me too:

OS: Pop!_OS 22.04 LTS x86_64
DE: GNOME 42.1

@richardhttps
Copy link

Still broken for me, GTK, Arch Linux

@waldyrious
Copy link

Quoting @meduzen's comment from the corresponding issue for Android, in case it helps others who are tracking this issue:

this [...] is linked to fingerprinting (see brave/brave-core#9735).

the flag to opt-out of this restriction is at brave://flags/#brave-dark-mode-block.

@brunolpsousa
Copy link

Quoting @meduzen's comment from the corresponding issue for Android, in case it helps others who are tracking this issue:

this [...] is linked to fingerprinting (see brave/brave-core#9735).

the flag to opt-out of this restriction is at brave://flags/#brave-dark-mode-block.

It's not the same issue as reported above. It's not related to fingerprint protection but an upstream bug.

@simonhong simonhong moved this from Untriaged backlog to In progress in Settings Nov 21, 2023
simonhong added a commit to brave/brave-core that referenced this issue Nov 21, 2023
simonhong added a commit to brave/brave-core that referenced this issue Nov 21, 2023
simonhong added a commit to brave/brave-core that referenced this issue Nov 21, 2023
@brave-builds brave-builds added this to the 1.62.x - Nightly milestone Nov 22, 2023
@rebron rebron moved this from In progress to Completed in Settings Nov 22, 2023
@Lazerbeak12345
Copy link

Thank you so much! I once I get this update I can test if it fixed a few associated issues 😊

@kjozwiak
Copy link
Member

The above requires 1.61.93 or higher for 1.61.x verification 👍

@btlechowski
Copy link
Collaborator

Verified with

Brave 1.61.93 Chromium: 119.0.6045.199 (Official Build) (64-bit)
Revision f707e858dc981208907fd0be3314d081a5dc86ae
OS Linux

Using the STR/Cases outlined via brave/brave-core#21065 (comment), ensured that the fix/changes were working as per the following:

Same as Linux (Light Theme)

image

Same as Linux (Dark Theme)

image

Dark Theme (Linux theme set as Light)

image

Light Theme (Linux theme set as Dark)

image

@rebron
Copy link
Collaborator

rebron commented Dec 7, 2023

Latest release 1.61.100 has this fix.

@rebron rebron removed this from Completed in Settings Dec 7, 2023
@Lazerbeak12345
Copy link

Lazerbeak12345 commented Dec 7, 2023

Latest release 1.61.100 has this fix.

Can verify, Brave's Chrome does now sync with the system. However, webpages (when set to match system theme), like search.brave.com do not. Should this be reported separately?

Happens on both GNOME and KDE, both X11 and Wayland, (Fedora 36, 37, 38, 39, and Funtoo). Does not (under any combination) happen on Firefox (so it's not a bug with the website, the System, the Distro, or the WM).

My workaround for the last few years has been to use webpage-specific settings when possible, the Stylus extension when that isn't possible, and suffer from blindingly bright screens otherwise. Many webpages that have dark themes don't have settings for it and also don't have a Stylus sheet for them either.

Dark system, Brave Web Browser matches Linux, Brave Search Matches system

image
image
image
image

Light system, Brave Web Browser matches Linux, Brave Search Matches system

image
image
image
image

EDIT: fixed. The issue was that I had turned on maximum fingerprinting blocking.

@brunolpsousa
Copy link

brunolpsousa commented Dec 7, 2023

Latest release 1.61.100 has this fix.

Can verify, Brave's Chrome does now sync with the system. However, webpages (when set to match system theme), like search.brave.com do not. Should this be reported separately?

Happens on both GNOME and KDE, both X11 and Wayland. Does not (under any combination) happen on Firefox (so it's not a bug with the website).

My workaround for the last few years has been to use webpage-specific settings when possible, the Stylus extension when that isn't possible, and suffer from blindingly bright screens otherwise. Many webpages that have dark themes don't have settings for it and also don't have a Stylus sheet for them either.

It's working fine for me on Arch with GNOME 45 Wayland, flatpak version (but I have tested the nightly from AUR and it also worked as expected). Edit: I'm still using the same old Brave profile, it was not needed to reset or create a new one.

Does this also happen for you if using the default Adwaita theme and a fresh Brave profile? If so, you should open a separate issue here on gh or on the other Brave support channels, so we don't bother all the people subscribed to this issue. Since the fix worked for me and for the Brave devs, it should be something related with your system and/or configurations.

PS: Thanks for the Brave team for implementing this for us Linux users! ^-^

@Lazerbeak12345
Copy link

Ah. That might be related. I'm not running a sandboxed version.

On Fedora I'm using the .rpm (through dnf)

On Funtoo I'm using www-client/brave-bin

@Lazerbeak12345
Copy link

Lazerbeak12345 commented Dec 7, 2023

Edit, at a glance, a fresh profile does work.

I still think this is a bug though - since I'd have to lose all my settings, bookmarks, extensions, and passwords to be able to fix it.

Separate issue will be reported if I have the time.

@SlowNicoFish
Copy link

SlowNicoFish commented Dec 7, 2023

Can confirm it works on EndeavourOS with https://aur.archlinux.org/packages/brave-bin (brave-bin 1:1.61.100-1)

@nandorholozsnyak
Copy link

🚀 Waiting for this for years. Works on Pop!_OS 22.04 LTS x86_64 GNOME 42.5 .

@ahydronous
Copy link

ahydronous commented Dec 18, 2023

It is working for me with "Classic", but choosing "GTK" keeps Brave stuck in the light theme, even when forcing it to "Dark".

After flipping and restarting a few times, it seems it is the other way around. When using GTK for theme, it will always follow the GTK theme instead of following manually set light or dark. I guess for that to work properly (or properly within flatpak?) it would have to toggle some sort of GTK override

@wknapik
Copy link
Contributor

wknapik commented Dec 18, 2023

This issue is almost 3 years old, has 58 comments, many subscribers and is already resolved.

If anything is not working correctly, please open a new issue and describe the problem there.

@madhums
Copy link

madhums commented Jan 17, 2024

Not working! Re-open please!!

@Lazerbeak12345
Copy link

@madhums open a new issue please

@kjozwiak
Copy link
Member

Not working! Re-open please!!

As per the comment via #14685 (comment), please open a new issue if you're still having issues and include as much information as possible. You can create a new issue via here.

@madhums
Copy link

madhums commented Jan 18, 2024

Ok, so I uninstalled the flatpak version of brave, added the rpm repo and installed via that. It seems to work this way. So not sure what's really going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment