You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[themes] auto detect color scheme not working on Linux #91169
I did some debugging, this is where the magic happens.
Unfortunately, window.matchMedia((prefers-color-scheme: light)).matches === true and window.matchMedia((prefers-color-scheme: dark)).matches === false regardless of my system theme.
This is maybe a Chromium bug since the same wrong values are returned in Chromium but the right values are returned in Firefox. On the other hand, Chromium does auto-switch its color theme.
Also there's a nativeTheme Electron API. What does that have to do with this?
Reacted by Ronan Jouchet, Rafael Bernardelli, Stephan, Selwyn, Imran R., Bartek Pacia, Lorenz Hoffmann, su-ex, Felix Meyer-Wolters, Artem Sheremet and 11 more
I'm trying to figure out why since prefers-color-scheme is supposed to be OS and browser independent.
It's probably this and especially this bug.
Apparently someone tried to fix it but it didn't work out as expected.
Thanks for digging up the links. We will have to wait for Chromium to have the feature.
In the meantime I can disable the feature for Linux or add a remark to the description, if that's any help.
Tested with VSCode 1.50.1 on (Ubuntu) GNOME 3.26.3: It works when launching the editor but will not change when the theme is switched while the editor is open.
Reacted by ryanerwin, Marek Brenčič, Martin Carton, Aleksandr Mikhailov, Phil, Miko, Dallen Baldwin, Maximilian Thorn and Escape0707
Doesn't work for me on Fedora 35 and KDE switching between Breeze and Breeze Dark has no effect. Turning window.autoDetectColorScheme to true imediately switches to the Light theme.
@silviuvulcan not sure if there's such thing in KDE, but theme and color scheme are two different things. Theme is just a theme and color scheme should trigger changes accross the system if it's implemented (like in vscode or by default in gtk apps).
KDE has (not sure since what version) a global Dark/Light switch that changes theme and color scheme together. Also switching plasma style between a dark, light or "follow color scheme" one has no effect.
Due to either KDE not reporting it or vscode not reading it switching any of the above between light and dark has no effect in vscode. I think it's safe to assume this is fixed only for Gnome not Plasma.
Activity
gombosg commentedon Feb 21, 2020
I'm trying to figure out why since
prefers-color-schemeis supposed to be OS and browser independent.It's probably this and especially this bug.
Apparently someone tried to fix it but it didn't work out as expected.
gombosg commentedon Feb 21, 2020
I tested the
nativeThemeAPI and it also returns the wrong (always light theme) value on Linux. 😿aeschli commentedon Feb 25, 2020
Thanks for digging up the links. We will have to wait for Chromium to have the feature.
In the meantime I can disable the feature for Linux or add a remark to the description, if that's any help.
Siilwyn commentedon Oct 25, 2020
Tested with VSCode 1.50.1 on (Ubuntu) GNOME 3.26.3: It works when launching the editor but will not change when the theme is switched while the editor is open.
ryanerwin commentedon Oct 28, 2020
I'm getting the same behaviour as Selwyn (@Siilwyn)
When I close VSCode, I can get the theme to toggle between light and dark, but since VSCode is basically always open this doesn't really help.
Any suggestions on how to get this to work without closing VScode though? Even a command line workaround would be fine...
aeschli commentedon Oct 28, 2020
As mentioned, we're waiting for Electron/Chromium support to detect os color scheme changes. There's no workaround yet.
[-]auto detect color scheme not working on Linux[/-][+][themes] auto detect color scheme not working on Linux[/+](vscode) Do not specfiy workbench.colorTheme
(vscode) Update settings
thebrownfox commentedon Mar 21, 2022
Looks like it's been fixed. Works for me.
Martin Aeschlimann (@aeschli) You can probably close this one.
aeschli commentedon Mar 22, 2022
Yes, I can also confirm that this works for me on Ubuntu 21.10
filviu commentedon Mar 22, 2022
Doesn't work for me on Fedora 35 and KDE switching between Breeze and Breeze Dark has no effect. Turning
window.autoDetectColorSchemetotrueimediately switches to the Light theme.thebrownfox commentedon Mar 22, 2022
@silviuvulcan not sure if there's such thing in KDE, but theme and color scheme are two different things. Theme is just a theme and color scheme should trigger changes accross the system if it's implemented (like in vscode or by default in gtk apps).
Found this switcher but not sure whether it will be helpful
https://github.com/baduhai/Koi
Works for me on Arch Linux with Gnome 41.3 and oss version that uses system electron.
connor4312 commentedon Mar 23, 2022
Verified on Ubuntu as well
filviu commentedon Mar 24, 2022
KDE has (not sure since what version) a global Dark/Light switch that changes theme and color scheme together. Also switching plasma style between a dark, light or "follow color scheme" one has no effect.
Due to either KDE not reporting it or vscode not reading it switching any of the above between light and dark has no effect in vscode. I think it's safe to assume this is fixed only for Gnome not Plasma.
aeschli commentedon Mar 24, 2022
VS Code relies on Electron here, so please file an issue about missing support for KDE Dark/Light at https://github.com/electron/electron/issues.
You can use https://github.com/aeschli/electron-theme-test to test the Electron
nativeThemeAPI.firefoxic commentedon Apr 29, 2022
In Gnome 42, with the addition of the system light/dark theme switcher, this also broke.