illixion / vscode-vibrancy-continued

Enable Acrylic/Glass effect for your VS Code.
MIT License
572 stars 31 forks source link

feat: Add auto dark mode #146

Closed ShevonKuan closed 6 months ago

ShevonKuan commented 7 months ago

Refer to this issue https://github.com/illixion/vscode-vibrancy-continued/issues/51. I have added a solution to change Vibrancy preferences when the os change to dark/light mode automatically. The things you only need to do:

  1. Add "window.autoDetectColorScheme" = true in settings.json.
  2. Setting these two new things. image
  3. Change the apearence in your system settings. image
  4. Reload and restart vscode 7E7C566F-C0DB-48F2-8833-2A09B082B593B9696AE0-784F-4D24-BD75-D4130A25F1A5

https://github.com/illixion/vscode-vibrancy-continued/assets/49824574/c39d4661-a3a7-470e-98bf-9ec20240eb6d

As it is my impromptu modification, it may not be in line with your code posting style and the corresponding specification, ths.

illixion commented 6 months ago

Thanks for the contribution! Although I was wondering, have you considered using window.autoDetectColorScheme instead of dark-mode-listener as the trigger? It looks like this package is quite old, ships a binary and is macOS only, so perhaps there's a way to detect the VSCode theme change and use that to prompt the user for a reload instead.

ShevonKuan commented 6 months ago

As you said, dark-mode-listener may not be a good idea. However I have tried some solutions, unfortunately, not of them can work. Like the property of chromium, prefers-color-scheme. And window.autoDetectColorScheme is just only a bool value of the vscode config file. It's hardly for me to learn how this config work from the sourcecode of vscode.

illixion commented 6 months ago

I've looked into this and found a native API to monitor dark/light mode changes, and also solved an issue where the check wouldn't work if the user's theme is different from either of the preferred themes, will merge a refactored version of your code. Thanks again!

ShevonKuan commented 6 months ago

Appreciate you recognizing my idea and refining my immature code implementation. I would like to ask you what is the way to learn about this native api method.