mirror of
https://github.com/PR0M3TH3AN/bitblocks.git
synced 2026-10-27 16:00:39 +00:00
A monochrome, architectural landing tying BitLogin/BitGate/BitFeed/BitUnlock/ Tessera into one message. Parent brand distinct from every product (Alphabet-to-Google): the five product colours are the only chroma; monumental condensed Ubuntu Sans display, mono annotation layer, theme-aware. Sections: tenant->owner thesis, the five blocks, how they compose (Tessera as the worked example), foundation principles, builders CTA. Static, no build, CSP-locked. Co-Authored-By: Claude Fable 5 <[email protected]>
25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
// Theme toggle (light / dark / system), persisted. The page is theme-aware via
|
|
// CSS tokens; this only stamps an explicit choice on the root.
|
|
(() => {
|
|
const KEY = 'bitblocks:theme';
|
|
const root = document.documentElement;
|
|
const saved = localStorage.getItem(KEY);
|
|
if (saved === 'light' || saved === 'dark') root.setAttribute('data-theme', saved);
|
|
|
|
const btn = document.getElementById('theme');
|
|
const glyph = () => {
|
|
const t = root.getAttribute('data-theme');
|
|
btn.textContent = t === 'dark' ? '☾' : t === 'light' ? '☀' : '◑';
|
|
};
|
|
glyph();
|
|
btn?.addEventListener('click', () => {
|
|
const cur = root.getAttribute('data-theme');
|
|
const prefersDark = matchMedia('(prefers-color-scheme: dark)').matches;
|
|
// Cycle: system → opposite of system → the other → system.
|
|
const next = !cur ? (prefersDark ? 'light' : 'dark') : cur === (prefersDark ? 'light' : 'dark') ? (prefersDark ? 'dark' : 'light') : null;
|
|
if (next) { root.setAttribute('data-theme', next); localStorage.setItem(KEY, next); }
|
|
else { root.removeAttribute('data-theme'); localStorage.removeItem(KEY); }
|
|
glyph();
|
|
});
|
|
})();
|