Add dark/light mode toggle and coolors.co palettes

Admin UI:
- system / light / dark switch in the sidebar (cycle button on
  mobile), stored in localStorage and applied before first paint
- dark mode now driven by data-theme instead of only the media query

Link page themes:
- keep the Midnight and Paper presets, replace the others with the
  4 trending palettes from coolors.co
- paste a coolors.co link (or a bare hex list) to use any palette;
  the colors are read from the URL, nothing is fetched
- palettes are mapped to background, text and button colors by
  contrast, with a dark/light background choice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 16:27:21 +02:00
co-authored by Claude Opus 5.5
parent 74ce76ab8b
commit 624517e010
13 changed files with 477 additions and 82 deletions
+5
View File
@@ -1,6 +1,7 @@
import type { ReactNode } from "react";
import { KeyRound, LayoutDashboard, Link2, LogOut, PanelsTopLeft, ShieldCheck } from "lucide-react";
import type { Me } from "../../shared/api-types.js";
import { ThemeCycleButton, ThemeSwitch } from "../components/ThemeToggle.js";
import { Button } from "../components/ui/button.js";
import { Link } from "../components/ui/misc.js";
import { cx } from "../lib/cx.js";
@@ -74,6 +75,9 @@ export function Shell({ me, route, onLogout, children }: { me: Me; route: Route;
</Link>
))}
</nav>
<div className="px-4 pb-3">
<ThemeSwitch />
</div>
<div className="flex items-center gap-3 border-t border-border p-4">
<UserAvatar username={me.username} />
<div className="min-w-0 flex-1">
@@ -90,6 +94,7 @@ export function Shell({ me, route, onLogout, children }: { me: Me; route: Route;
<header className="sticky top-0 z-30 flex h-14 items-center justify-between border-b border-border bg-surface/85 px-4 backdrop-blur lg:hidden">
<Logo />
<div className="flex items-center gap-1">
<ThemeCycleButton />
<UserAvatar username={me.username} />
<Button variant="ghost" size="icon-sm" onClick={onLogout} aria-label="Sign out">
<LogOut />