Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
Detect changes to system theme on first load
Sebastian Martinez committed 1 year ago
commit f19ecf09edb27e8197bfe15d541a18f54258011e
parent 691e025
1 file changed +11 -1
modified src/App.svelte
@@ -2,7 +2,12 @@
  import * as router from "@app/lib/router";
  import { unreachable } from "@app/lib/utils";

-
  import { codeFont, followSystemTheme, theme } from "@app/lib/appearance";
+
  import {
+
    codeFont,
+
    followSystemTheme,
+
    loadTheme,
+
    theme,
+
  } from "@app/lib/appearance";

  import FullscreenModalPortal from "./App/FullscreenModalPortal.svelte";
  import Hotkeys from "./App/Hotkeys.svelte";
@@ -32,6 +37,11 @@
      }
    });

+
  // Detect any change to the system theme on first load.
+
  if ($followSystemTheme) {
+
    theme.set(loadTheme());
+
  }
+

  void router.loadFromLocation();

  $: document.documentElement.setAttribute("data-codefont", $codeFont);