microsoft / vscode

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

`Window: Auto Detect Color Scheme` option stops working #194771

Closed rakleed closed 6 months ago

rakleed commented 1 year ago

Type: Bug

Window: Auto Detect Color Scheme stops working after some time. Now I have this option enabled, the system uses a dark theme, but VS Code runs all the time in a light theme.

VS Code version: Code 1.82.3 (Universal) (fdb98833154679dbaa7af67a5a29fe19e55c2b73, 2023-10-02T11:06:17.496Z) OS version: Darwin arm64 23.0.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|5, 4, 4| |Memory (System)|8.00GB (0.14GB free)| |Process Argv|--crash-reporter-id 8d56dc33-b22c-4858-806c-423cc4562dab| |Screen Reader|no| |VM|0%|
Extensions (38) Extension|Author (truncated)|Version ---|---|--- op-vscode|1Pa|1.0.4 bemhelper|Box|1.4.5 vscode-tailwindcss|bra|0.10.0 prettier-vscode-standard|bys|0.22.1 binary-plist|dni|0.11.3 gitlens|eam|14.3.0 vscode-html-css|ecm|1.13.1 EditorConfig|Edi|0.16.4 prettier-vscode|esb|10.1.0 auto-close-tag|for|0.5.14 auto-rename-tag|for|0.1.10 copilot|Git|1.122.462 copilot-chat|Git|0.7.1 remotehub|Git|0.60.0 gitlab-workflow|Git|3.80.0 vscode-gutter-preview|kis|0.30.0 vscode-docker|ms-|1.26.1 vscode-language-pack-ru|MS-|1.82.2023091309 isort|ms-|2023.10.1 python|ms-|2023.16.0 vscode-pylance|ms-|2023.9.30 jupyter|ms-|2023.8.1002501831 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.17 vscode-jupyter-cell-tags|ms-|0.1.8 vscode-jupyter-slideshow|ms-|0.1.5 remote-containers|ms-|0.309.0 azure-repos|ms-|0.36.0 remote-repositories|ms-|0.38.1 vsliveshare|ms-|1.0.5883 subtitles-editor|pep|1.1.7 LiveServer|rit|5.7.9 autoimport|ste|1.5.4 code-spell-checker|str|3.0.1 code-spell-checker-russian|str|2.1.0 pdf|tom|1.2.2 vscode-postcss|vun|2.0.2 markdown-all-in-one|yzh|3.5.1
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vsdfh931cf:30280410 vshan820:30294714 vstes263:30335439 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30410667 py29gd2263:30792226 vscaac:30438847 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 282f8724:30602487 f6dab269:30613381 showlangstatbar:30737416 962ge761:30841074 a2ce3375:30757347 57b77579:30736110 pythonfmttext:30731395 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 pythonnosmt12:30797651 pythonidxptcf:30805731 pythonnoceb:30805159 copilotsettingt:30839829 asynctok:30821568 dsvsc013:30795093 dsvsc014:30804076 diffeditorv2:30821572 dsvsc015:30845448 ```
aeschli commented 1 year ago

The VS Code theme is only updated when it detects an OS theme change. Once you change it manually, it will stick to the theme you manually selected. Also, what do you have configured as workbench.preferredDarkColorTheme

rakleed commented 1 year ago

@aeschli

The VS Code theme is only updated when it detects an OS theme change.

That is, when you start VS Code, it doesn’t automatically check which theme is currently selected in the system?

Also, what do you have configured as workbench.preferredDarkColorTheme

Dark Modern (default)

supriokundu commented 1 year ago

I'm also having the same issues since the Last Update...VS Code won't auto switch the themes

Version: 1.83.0 Commit: e7e037083ff4455cf320e344325dacb480062c3c Date: 2023-10-03T16:11:49.843Z Electron: 25.8.4 ElectronBuildId: 24154031 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Linux x64 5.15.0-86-generic

Linux Mint 21.2 Cinnamon

Auto Detect Color Scheme is enabled in both User & Workspace settings

itsthejb commented 11 months ago

What I believe happens is that VSCode won't detect the OS theme change when it's not in the foreground. Manually toggling the setting will force it to update

DanielHerr commented 9 months ago

I am also having this problem on Windows and Chrome OS. I also tried a fresh VSCode.dev instance without account and observed the same behavior. While running and the system theme changes, it will be handled correctly, but when the theme is changed while VSC is not running, it won't correctly detect the current theme when starting.

rben01 commented 7 months ago

Sometimes I will activate VSCode and it will immediately switch from the system’s current light/dark theme to the other theme. For instance, if my computer is in light mode, I'll activate VSCode (which is already open, I'm just bringing it to the foreground), it'll open in light mode (good), and then immediately switch to dark mode (bad). I can force it to switch back to the correct theme this by unchecking and rechecking the “auto detect color scheme” setting (window.autoDetectColorScheme), at which point it correctly goes back to the light theme. I've seen this happen in the other direction as well (computer in dark mode, VSCode activates in dark mode, then immediately switches to light mode.)

aeschli commented 6 months ago

The theme switching story has been simplified: See https://github.com/microsoft/vscode/issues/158314#issuecomment-2069715771 Marking as duplicate