Vscode: [themes] auto detect color scheme not working on Linux

Created on 21 Feb 2020  路  6Comments  路  Source: microsoft/vscode



  • VSCode Version: latest stable & also 1.43.0-insider
  • OS Version: Fedora 31, GNOME 3.34.4

Steps to Reproduce:

  1. Launch VScode, set window.autoDetectColorScheme to true
  2. Set dark/light Adwaita theme in GNOME
  3. Firefox 73 & Chromium 79 does react, VS Code doesn't.


Does this issue occur when all extensions are disabled?: Yes/No

VS Code insiders, fresh profile.

Version: 1.43.0-insider
Commit: e6a45f4242ebddb7aa9a229f85555e8a3bd987e2
Date: 2020-02-21T05:40:52.685Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 5.4.20-200.fc31.x86_64

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?

debt feature-request themes

Most helpful comment

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.

All 6 comments

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.

I tested the nativeTheme API and it also returns the wrong (always light theme) value on Linux. :crying_cat_face:

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.

I'm getting the same behaviour as @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...

As mentioned, we're waiting for Electron/Chromium support to detect os color scheme changes. There's no workaround yet.

Was this page helpful?
0 / 5 - 0 ratings