Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add `prefers-color-scheme` query for theme fallback
Sebastian Martinez committed 2 years ago
commit 91866f629283b506cfeb69a5210dcd2e8fd0b1f3
parent cee200e629ba85a63c1d202cace5e8d1c55d5b3f
2 files changed +3 -1
modified playwright.config.ts
@@ -16,6 +16,7 @@ const config: PlaywrightTestConfig = {
  reporter: "list",
  globalSetup: "./tests/support/globalSetup",
  use: {
+
    colorScheme: "dark",
    actionTimeout: 5000,
    baseURL: "http://localhost:3001",
    trace: "retain-on-failure",
modified src/lib/appearance.ts
@@ -30,10 +30,11 @@ function loadCodeFont(): CodeFont {
}

function loadTheme(): Theme {
+
  const { matches } = window.matchMedia("(prefers-color-scheme: dark)");
  const storedTheme = window.localStorage.getItem("theme");

  if (storedTheme === null) {
-
    return "dark";
+
    return matches ? "dark" : "light";
  } else {
    return storedTheme as Theme;
  }