feat: initial shared design system extracted from newerror
Foundation + chrome for the bchen.dev static sites: design tokens, Spectral / Helvetica / IBM Plex Mono type, base + .prose typography, data-driven nav + footer, and prefers-color-scheme + [data-theme] dark mode with a pre-paint init. Colors are overridable CSS custom properties (defaults = newerror's palette); each site sets only its own colors.css. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C96hwEU9cM7mJpqATiv7R5
This commit is contained in:
14
theme-init.js
Normal file
14
theme-init.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/* static-design-system — theme-init.js
|
||||
Pre-paint: apply the stored [data-theme] before first paint so there is no
|
||||
flash. This file is inlined into <head> by ds/head.html (see head.html); it
|
||||
must run before the stylesheet paints, so keep it tiny and synchronous.
|
||||
NOTE: no Liquid delimiters allowed here (this content is passed through the
|
||||
Jekyll include tag). Storage key must match theme-toggle.js. */
|
||||
(function () {
|
||||
try {
|
||||
var t = localStorage.getItem("bchen-theme");
|
||||
if (t === "light" || t === "dark") {
|
||||
document.documentElement.setAttribute("data-theme", t);
|
||||
}
|
||||
} catch (e) {}
|
||||
})();
|
||||
Reference in New Issue
Block a user