# Permanent Dark Mode?

**URL:** <https://community.silverbullet.md/t/permanent-dark-mode/370>\
**Category:** General\
**Created:** [April 7, 2024, 8:04pm UTC](https://community.silverbullet.md/t/permanent-dark-mode/370 "2024-04-07T20:04:34Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![ChenZhu-Xie](https://community.silverbullet.md/user_avatar/community.silverbullet.md/chenzhu-xie/32/1476_2.png) [@ChenZhu-Xie](https://community.silverbullet.md/u/ChenZhu-Xie)\
**Post date:** [November 2, 2025, 11:38am UTC](https://community.silverbullet.md/t/permanent-dark-mode/370/9 "2025-11-02T11:38:40Z")

</div>

Below **forced Dark Mode** works properly under v2:

```auto
event.listen {
  -- name = 'system:ready',
  name = 'editor:init',
  run = function(e)
    if clientStore.get("darkMode") then
      editor.flashNotification("Current Theme: Dark")
    else
      editor.flashNotification("Current Theme: Light")
      clientStore.set("darkMode", true)
      editor.reloadUI()
    end
  end
}

```

It functions across browsers on both mobile and PC.

However, **after the first full indexing from scratch on a mobile device, the interface may still remain in light mode**. It usually requires a manual refresh to trigger the `editor:init` event and properly switch to dark mode.

I was therefore searching for a suitable event that would activate dark mode only after `index:complete` (an event not exist).

I first found that the `system:ready` event is roughly equivalent to `editor:init`, but it seemingly occurs before the `index:complete` event, so it doesn’t solve the issue.

Then I tried the `editor:complete` event (found through [event](https://silverbullet.md/API/event#event.listEvents())), but that didn’t work either.

The `editor:pageLoaded` event also fires before `index:complete`, so it’s not a viable solution either. (inspired from [Index Page](https://silverbullet.md/Index%20Page))

At last, I discovered this **dark magic** :

```auto
-- priority: -1 
event.listen {
  -- name = "editor:pageLoaded",
  name = "hooks:renderTopWidgets",
  run = function(e)
    if not clientStore.get("darkMode") then
      clientStore.set("darkMode", true)
      editor.reloadUI()
    end
  end
}

```

it works perfectly after `index:complete`. Now, no matter how the user tinkers with SB, **dark mode is the final destination** (even if there’s no TopWidgets on the page?).

---

_[View the full topic](https://community.silverbullet.md/t/permanent-dark-mode/370)._
