Automatically adhere to system light/dark mode setting

Many operating systems (e.g. macOS) have a setting to automatically switch between light and dark themes according to the time of day in the user’s current time zone. It would be great if Obsidian would adhere to such settings so that users don’t have to manually toggle light/dark mode twice daily.

36 Likes

As @liam pointed out on Discord

Using media query work as expected :

@media (prefers-color-scheme: dark) {
  <css changes you want for dark mode>
}

Work pretty great. Basically i override .theme-light {} by putting this under regular .theme-light { ... } and i set my theme to light. Like this :

@media (prefers-color-scheme: dark) {
  .theme-light { ... }
}

You’d have to override default theme-light { ... } rules with default .theme-dark { ... } rules too since the app still believe you are in light-mode and usually themes don’t override some default .theme-(dark/light) rules because default one works great with said theme ; but in our case, we want to override all .theme-light rules with .theme-dark ones when our system is in dark mode (Everything under prefers-color-scheme: dark)

2 Likes

We need AUTOMATIC change color scheme.

Just follow the system automatically

4 Likes

Why do I have to go through from light to dark or from dark to light … twice a day …

3 Likes

Where should I go to write this css code ?

+1 for this. Every time I toggle between light and dark mode for macOS, I would also need to do the same for Obsidian, which is a bit inconvenient. Would be great if toggling the system’s mode would also automatically toggle Obsidian’s.

Yes, a built in setting for this would be great! :smile:

1 Like

If it’s not possible for Obsidian to ‘read’ that information from the operating system (since different people have different operation systems), what about an option in the settings where we can specify a schedule?

For instance, use Dark mode from 20:00 till 7:00.

5 Likes

This feature is now available if you use Minimal Theme with the Minimal Theme Settings plugin. It’s also available as a separate plugin called System Dark Mode that should be compatible with most themes.

13 Likes

Thanks so much for this plugin! I was stoked when I first saw it in the community plugins.

If I may give a “bug report” in this thread, refreshing Obsidian resets the light/dark mode. Both Obsidian and the OS were in dark mode at first; when I refreshed Obsidian, it turned to light mode again. I did toggle the system’s mode to see if the plugin is working, and it is; just a minor bug.

Thank you for adding this request @evanm. I would like to add that this setting is also useful for automation. I have a global Keyboard Maestro combination to toggle between both. Obsidian is the only app in addition to BBEdit which does not switch on its own.

Provide option for Obsidian to automatically adapt to the current appearance of MacOS (Light Mode / Dark Mode)

4 Likes

More specifically, the UI dialog used to open other vaults does not adapt the current theme colors. Inherit the colors from the active theme and apply them to the selection window. Either set this by default. Alternatively as an option that can be checked, or provide drop-down to select theme for the window in case people have different themes applied to different vaults.

I would like to add that although different operational systems use different mechanisms, I imagine that some specific code for platform is already present, at least obviously on Electrum, so it could be done on Obsidian.

The plugin unfortunately doesn’t work on Android.

1 Like

Any chance this to be implemented? Personally, I’m interested in auto-switching dark/light themes on iOS and MacOS.

Great that there’s already a plugin, but this should definitely get implemented, and IMO it should also be the default enabled setting (at least on macOS that’s the platform policy).

Obsidian:
image

Notion:

2 Likes

It’s a feature in Electron itself, so Obsidian could implement it without additional framework.

1 Like

Hello, I’m happy user of “System dark mode” plugin for Obsidian.

But, I’ve got one question. Is it possible to change theme in memory without changing appearance.json? My vault is under Git and every evening, after system appearance has been automatically changed to dark I have to ignore appearance.json during staging files for commit:

{
   "baseFontSize": 16,
-  "theme": "moonstone",
+  "theme": "obsidian",
...

Have you considered adding it to your gitignore file?