Light and dark: a switch in the top bar
Three choices: as the device is (the default), light, or dark, kept in a "theme" cookie per browser. The dark colours move to dark.css, linked with a media attribute from the cookie, so the server renders the page in the chosen colours with no flash (the CSP allows no inline script). app.js sets the cookie and switches the media at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,43 +44,7 @@
|
||||
color-scheme: light;
|
||||
}
|
||||
|
||||
/* Dark: brain's readability pass, body text at about 13:1 rather than a
|
||||
glaring near-white on near-black. */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: 240 6% 10%;
|
||||
--foreground: 0 0% 92%;
|
||||
--card: 240 5% 13%;
|
||||
--primary: 245 60% 60%;
|
||||
--primary-foreground: 0 0% 100%;
|
||||
--secondary: 240 4% 19%;
|
||||
--muted: 240 4% 19%;
|
||||
--muted-foreground: 240 5% 64.9%;
|
||||
--accent: 245 30% 20%;
|
||||
--accent-foreground: 245 60% 75%;
|
||||
--destructive: 0 70% 62%;
|
||||
--border: 240 4% 19%;
|
||||
--input: 240 4% 25%;
|
||||
--ring: 245 60% 60%;
|
||||
--sidebar: 240 6% 8%;
|
||||
--sidebar-foreground: 0 0% 85%;
|
||||
--ok: 142 55% 55%;
|
||||
--ok-bg: 142 30% 14%;
|
||||
--warn: 38 90% 65%;
|
||||
--warn-bg: 35 40% 13%;
|
||||
--warn-border: 35 50% 30%;
|
||||
--bad-bg: 0 40% 14%;
|
||||
--bad-border: 0 45% 32%;
|
||||
--teal: 160 60% 55%;
|
||||
--teal-bg: 160 30% 14%;
|
||||
--coral: 20 80% 65%;
|
||||
--coral-bg: 20 40% 14%;
|
||||
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.15), 0 1px 2px -1px rgb(0 0 0 / 0.15);
|
||||
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.15);
|
||||
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.25), 0 4px 6px -4px rgb(0 0 0 / 0.15);
|
||||
color-scheme: dark;
|
||||
}
|
||||
}
|
||||
/* The dark colours are in dark.css. */
|
||||
|
||||
/* --- Base --- */
|
||||
* { box-sizing: border-box; border-color: hsl(var(--border)); }
|
||||
@@ -283,6 +247,10 @@ button:disabled, button:disabled:hover { opacity: 0.5; cursor: not-allowed; box-
|
||||
button.small { padding: 0.28rem 0.75rem; font-size: 0.82rem; }
|
||||
.icon-button { padding: 0.35rem; background: transparent; color: hsl(var(--foreground)); box-shadow: none; }
|
||||
.icon-button:hover { background: hsl(var(--accent)); box-shadow: none; }
|
||||
.theme-switch { display: flex; gap: 0.15rem; margin-left: auto; padding: 0.15rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--background)); }
|
||||
.theme-switch .icon-button { color: hsl(var(--muted-foreground)); border-radius: var(--radius-sm); }
|
||||
.theme-switch .icon-button[aria-pressed="true"] { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
|
||||
.bare-shell .theme-switch { margin: 0.75rem auto 0; width: max-content; }
|
||||
.actions { display: flex; gap: 0.75rem; align-items: center; margin: 1rem 0 1.5rem; flex-wrap: wrap; }
|
||||
.danger-zone { margin-top: 2rem; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user