microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.38k stars 28.62k forks source link

vscode July 2024 incorrectly detects light theme (instead of dark theme) on Linux with Cinnamon #225470

Open perlun opened 1 month ago

perlun commented 1 month ago

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

Steps to Reproduce:

  1. Upgrade code from 1.88.1-1712771838 to the latest 1.92.1-1723066302 version.

  2. Have the preferred themes set to this:

    
    {
       "workbench.preferredLightColorTheme": "Quiet Light",
       "workbench.preferredDarkColorTheme": "One Dark Pro",
    }
  3. Have a dark theme enabled on Linux (I use a custom theme for Cinnamon based on Adapta-Nokto.

VS Code will incorrectly use the Quiet Light theme on my machine, with the above setup, instead of the preferredDarkColorTheme (One Dark Pro).

More details

With the previous version (1.88.1-1712771838) VS Code would correctly use One Dark Pro when I was using a dark desktop theme. When using a light desktop theme, I think it automatically used the light theme. (I use the dark desktop theme most of the time, except when coding outdoors. :sunglasses:)

With the new version, this detection has suddenly stopped working. If I manually override the theme in VS Code to One Dark Pro, it changes my settings.json thusly, which is why I believe it incorrectly detects my desktop as "using light mode".

diff --git vscode/settings.json vscode/settings.json
index d2deaa3..8520e88 100644
--- vscode/settings.json
+++ vscode/settings.json
@@ -551,7 +551,7 @@
     // All of these play together in making a better light/dark mode switching
     // experience
     "window.autoDetectColorScheme": true,
-    "workbench.preferredLightColorTheme": "Quiet Light",
+    "workbench.preferredLightColorTheme": "One Dark Pro",
     "workbench.preferredDarkColorTheme": "One Dark Pro",

     "yaml.format.enable": true,

Please help me find why this behavior has changed. :thinking: Was the Electron version upgraded in this VS Code update, was some Electron settings adjusted? Could there be anything else triggering this?

aeschli commented 1 month ago

Yes, there was an Electron update (you can see that in the Help > About dialog). I'm not aware of other similar user reports.

To find out what Electron reports you can:

In the console you should see shouldUseDarkColors: true, shouldUseHighContrastColors: false, shouldUseInvertedColorScheme: false

shouldUseDarkColors: true means that Electron has discovered dark mode

You can try that. If it shows the wrong mode, we need to file an issue against Electron

perlun commented 4 weeks ago

To find out what Electron reports you can:

[...]

In the console you should see shouldUseDarkColors: true, shouldUseHighContrastColors: false, shouldUseInvertedColorScheme: false

shouldUseDarkColors: true means that Electron has discovered dark mode

You can try that. If it shows the wrong mode, we need to file an issue against Electron

Thanks. :+1: I tried this now, and the findings are quite interesting in fact:

~/git/tmp/electron-theme-test on  master took 8s 
❯ npm start

> burly-rate-begin-iqsp1@1.0.1 start
> electron-forge start

✔ Checking your system
✔ Locating application
✔ Loading configuration
✔ Preparing native dependencies [0.1s]
✔ Running generateAssets hook

shouldUseDarkColors: true, shouldUseHighContrastColors: false, shouldUseInvertedColorScheme: false
shouldUseDarkColors: true, shouldUseHighContrastColors: false, shouldUseInvertedColorScheme: false
shouldUseDarkColors: true, shouldUseHighContrastColors: false, shouldUseInvertedColorScheme: false
shouldUseDarkColors: false, shouldUseHighContrastColors: false, shouldUseInvertedColorScheme: false
shouldUseDarkColors: false, shouldUseHighContrastColors: false, shouldUseInvertedColorScheme: false
shouldUseDarkColors: false, shouldUseHighContrastColors: false, shouldUseInvertedColorScheme: false

It seems to "first detect dark mode" and then switch over to light mode for some reason. :thinking: This also matches what it looked like after the update: it (VS Code) first started using the dark theme, then after ~500ms or so switched over to the light theme. :astonished: There seems to be something really edgy going on here... What does the electron-theme-test output on your machine?

aeschli commented 4 weeks ago

I'm on Ubuntu 22.04.4 LTS, Gnome 42.9

With OS dark mode:

Image

With OS light mode:

Image

perlun commented 3 weeks ago

Thanks. :+1: This looks really, really weird indeed. Would you want to file a bug to the Electron people about this? I can happily provide more details on my system/etc as needed. As noted, this has worked flawlessly in earlier versions of Electron on the same machine for me.

aeschli commented 3 weeks ago

Cn you file the issue. You have all the details about your platform, and when there are any questions, they go to you. https://github.com/electron/electron/issues

perlun commented 3 weeks ago

Alright, there we go @aeschli: https://github.com/electron/electron/issues/43416