Files
boocode/apps/web/src/styles/themes/midnight-sapphire.css
indifferentketchup 9b174cdb5e themes-v1: 18 preset palettes + Settings picker
Adds 18 preset themes (16 dual-mode + 2 light-only) selectable from
a new /settings route. Persists per-user via the existing key-value
settings table — no schema refactor. Default on first load is
obsidian dark.

Storage: two new seeded keys (theme_id, theme_mode) inserted
idempotently from schema.sql. PATCH /api/settings tightens validation
with a discriminated branch — theme_id must be one of the 18
whitelisted ids, theme_mode ∈ {dark,light,system}, anything else
rejects 400. Other keys pass through the loose record schema.

CSS layer: 18 files in apps/web/src/styles/themes/, each declaring
.theme-<id> (light) and .theme-<id>.dark (dark) — except ivory and
chalk which are light-only. Anchor-to-token mapping per spec §3.
--destructive stays red across all themes. --radius unchanged at
0.625rem (spec parenthetical was about "not per-theme", not a
specific value swap).

Frontend: lib/theme.ts owns THEMES, applyTheme(), setTheme(), and
useTheme() — module-singleton with optimistic PATCH + revert on
failure (mirrors useChatStatus / useSidebar pattern). Settings.tsx
renders a 3-col (md) / 2-col (mobile) grid of shadcn Card swatches
with a Dark/Light/System radio group on top. App.tsx mounts
useTheme() at AppShell top and wires the /settings route.
index.html ships a pre-React FOUC script that reads localStorage
'boocode.theme' and stamps the className on <html> before any
paint. Stripped two pre-existing dark-mode lock-ins (AppShell's
hardcoded 'dark' className and body's neutral-950/100 tailwind
utilities) that would have fought theme tokens.

Light-only + dark request → falls back to obsidian dark in three
places: lib/theme.ts effectiveThemeId(), the FOUC script, and the
picker's "Light only" badge. No inline message; matches spec §8
decision 1.

shadcn primitives card and radio-group installed via shadcn CLI
(no hand-rolling). card.tsx and radio-group.tsx are the only ui/
additions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 16:25:15 +00:00

61 lines
1.6 KiB
CSS

/* themes-v1: Midnight Sapphire (family: blue).
Dark anchors: #02050e #060c1f #0e1a36 #4a6088 #1e3a8a. */
.theme-midnight-sapphire {
--background: #f4f6fc;
--foreground: #0a1024;
--card: #e6eaf6;
--card-foreground: #0a1024;
--popover: #e6eaf6;
--popover-foreground: #0a1024;
--primary: #142a60;
--primary-foreground: #ffffff;
--secondary: #d0d8ec;
--secondary-foreground: #0a1024;
--muted: #d0d8ec;
--muted-foreground: #36507a;
--accent: #142a60;
--accent-foreground: #ffffff;
--destructive: #b91c1c;
--destructive-foreground: #ffffff;
--border: #d0d8ec;
--input: #d0d8ec;
--ring: #142a60;
--sidebar: #e6eaf6;
--sidebar-foreground: #0a1024;
--sidebar-primary: #142a60;
--sidebar-primary-foreground: #ffffff;
--sidebar-accent: #d0d8ec;
--sidebar-accent-foreground: #0a1024;
--sidebar-border: #d0d8ec;
--sidebar-ring: #142a60;
}
.theme-midnight-sapphire.dark {
--background: #02050e;
--foreground: #dce0f0;
--card: #060c1f;
--card-foreground: #dce0f0;
--popover: #060c1f;
--popover-foreground: #dce0f0;
--primary: #1e3a8a;
--primary-foreground: #dce0f0;
--secondary: #0e1a36;
--secondary-foreground: #dce0f0;
--muted: #0e1a36;
--muted-foreground: #4a6088;
--accent: #1e3a8a;
--accent-foreground: #dce0f0;
--destructive: #dc2626;
--destructive-foreground: #ffffff;
--border: #0e1a36;
--input: #0e1a36;
--ring: #1e3a8a;
--sidebar: #060c1f;
--sidebar-foreground: #dce0f0;
--sidebar-primary: #1e3a8a;
--sidebar-primary-foreground: #dce0f0;
--sidebar-accent: #1e3a8a;
--sidebar-accent-foreground: #dce0f0;
--sidebar-border: #0e1a36;
--sidebar-ring: #1e3a8a;
}