diff --git a/README.md b/README.md index 8572bfef..926916da 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Personal site hosted with GitHub Pages at **https://ascoding11.github.io**, the - `account/account.js`: optional Google sign-in, added to every page with the shared top bar. Uses the `rumblekarts` Firebase project (same as the analytics and the Back Room games). Signed-in visitors get a row in Firestore `members/{uid}` (name, email, photo, first/last visit, page count and the analytics visitor IDs of their browsers), which the analytics dashboard shows under Signed-in visitors. The Back Room games reuse a signed-in account instead of switching to an anonymous one. - `site.css`: styles shared by the home, Web Development Projects and Productivity pages - `theme.js`: the site's light/dark switch, with three choices: Auto (follow the device's light or dark mode, the default), Light and Dark. Loaded with a plain `` in the `
`, just before the stylesheet (not deferred, so it runs before the page is drawn and there's no flash), by every page that uses `site.css` and nothing else of its own for colours (home, Web Development Projects, Productivity, Engineering Projects, Marketplace, About, Project Daedalus, the Docket, Prompted, Boxed and Hype Cycle Exchange guides), by Docket and Prompted, the Back Room page, the phone page and the showcase landing page (which has no top bar, so no switch; it follows the choice made on any other page). **The switch** is one small button showing the current choice (half circle, sun or moon) that opens a menu with the three; theme.js puts it at the end of the page's `.topbar` by itself (its menu opens leftwards, or rightwards when the top bar has wrapped it to the left edge, as on a phone held sideways), right after the Sign in button (so `account/` is unchanged), which makes it the same place on every page with the top bar, the Back Room included; any other empty element with `data-theme-switch` is filled in too (the phone page has one in its header, since it has no top bar). **Storage:** localStorage `theme` (`light` or `dark`; removed for Auto), so the choice carries to every page; pages already open in other tabs, and pages inside frames (the home page's phone-version frame), follow a change straight away through the `storage` event. Nothing is stored online. **How the CSS follows it:** an explicit choice puts `data-theme="light"` or `data-theme="dark"` on ``, and Auto leaves it off. Each dark-mode block is written twice: inside `@media (prefers-color-scheme: dark)` as `:root:not([data-theme="light"])` (Auto, or Dark on a dark device), and again as `:root[data-theme="dark"]` (Dark on a light device). That's how `site.css`, `games.css`, Docket and Prompted do it; the phone page is dark by itself, so it does the opposite with its light look. A new page that uses `site.css` only needs the script line; a page with its own dark colours needs both blocks too. The shared Back Room scripts that add their own styles (party.js, avatar.js, miles.js, leaderboard.js, news.js, social.js, account-nudge.js, events.js, feedback.js and the rest) take their colours from the page's variables, so they follow without changes. `SiteTheme.get()` / `.set('auto'|'light'|'dark')` / `.wire(el)`, and a `site-theme` event on `window` after a change (seasons.js redoes its seasonal tint on it). **Pages that don't follow it** keep their own look: every game (each has its own fixed look, light or dark), the Daily Puzzles page, the admin page, and the pages that follow the device with their own CSS only: Boxed, Hype Cycle Exchange, the analytics dashboard and the privacy policy. -- `offline.js`, `sw.js`, `offline.html`: offline mode (version 2). `offline.js` (a deferred `