Theme switch: auto | light | dark, stored in localStorage ls.theme and on the account, applied before first paint on every page
themehead.js is the one source of the tiny inline head script (and of AUTO_DEFAULT, the one constant Marty decides later: 0 = nothing stored keeps the page's current look, light for Control Room and public pages, dark for the sapphire pages; 1 = follow the device). The script sets data-theme on <html> from ls.theme (auto follows prefers-color-scheme and tracks changes live) and exposes window.LSTheme. tools/stamp-theme-head.cjs writes it into every static page before the first stylesheet with data-theme-base on <html>; blog, leaderboard, what's-new, the badge page, the unsubscribe page and the wall 404 read the module directly. The site CSP allows inline scripts by hash only, so themehead.CSP_HASH joins script-src (the script was silently blocked until then).
Account side: accounts.theme (JSON store and MySQL, alterSafe column), in the public account JSON and /api/me; POST /api/my/profile {theme} rides the existing profile save path and never touches the username. cr-shell.js renders a Light / Dark / Auto segmented control in the topbar of every Control Room screen and paints every .theme-seg on the page (the Profile pane gains an Appearance card with the same control); a click applies at once, saves locally and to the account when signed in; at sign-in the account value wins over the local one, and a local choice is pushed up when the account has none yet. view.html stops reading an undefined --bg so its light variant has a light stage. ?v= tags bumped on every changed stylesheet and script (20261101t / ls20261101t).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+6
-5
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" data-theme-base="light">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Fuel Your Offers: the Monthly Refuel guide | LinkSpin</title>
|
||||
@@ -17,9 +17,10 @@
|
||||
<meta name="twitter:image" content="{{SITE_URL}}/banners/fuel-your-offers-1200x675.jpg">
|
||||
<meta name="theme-color" content="#0B1424">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<!--theme-head--><script>(function(){var A=0,h=document.documentElement,b=h.getAttribute("data-theme-base")||"light",m=window.matchMedia?matchMedia("(prefers-color-scheme: dark)"):{matches:false},v;function g(){try{v=localStorage.getItem("ls.theme")}catch(e){v=null}return v==="light"||v==="dark"||v==="auto"?v:(A?"auto":b)}function ap(){var c=g();h.setAttribute("data-theme",c==="auto"?(m.matches?"dark":"light"):c);h.setAttribute("data-theme-choice",c)}ap();if(m.addEventListener)m.addEventListener("change",ap);else if(m.addListener)m.addListener(ap);window.LSTheme={base:b,get:g,apply:ap,set:function(c,quiet){try{if(c==="light"||c==="dark"||c==="auto")localStorage.setItem("ls.theme",c);else localStorage.removeItem("ls.theme")}catch(e){}ap();if(!quiet)try{dispatchEvent(new CustomEvent("ls-theme",{detail:g()}))}catch(e){}}}})()</script><!--/theme-head-->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<link rel="icon" type="image/png" href="/logo-icon.png">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261007b">
|
||||
<link rel="stylesheet" href="/assets/pub.css?v=20261101t">
|
||||
<style>
|
||||
.rg{max-width:980px}
|
||||
.rg p{margin:0}
|
||||
@@ -39,7 +40,7 @@
|
||||
.rg-flow > li:not(:last-child)::before{content:"";position:absolute;left:17px;bottom:0;border:6px solid transparent;border-top-color:var(--line-strong);border-bottom:0}
|
||||
.rg-n{border:1px solid var(--line-strong);border-radius:8px;padding:10px 13px;font-size:14px;line-height:1.45;background:var(--panel);color:var(--ink-2);min-width:0}
|
||||
.rg-n b{display:block;font-weight:800;color:var(--ink);margin-bottom:2px}
|
||||
.rg-n .k{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;font:700 12px var(--mono);margin-right:6px;vertical-align:1px;background:var(--chrome);color:#fff}
|
||||
.rg-n .k{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;font:700 12px var(--mono);margin-right:6px;vertical-align:1px;background:var(--chrome);color:var(--chrome-ink)}
|
||||
.rg-n.start{border-color:var(--accent);background:var(--accent-soft)}
|
||||
.rg-n.ask{border-style:dashed;border-color:var(--ink-2)}
|
||||
.rg-n.go{border-color:var(--ok);background:var(--ok-soft)}
|
||||
@@ -61,12 +62,12 @@
|
||||
.rg-route{list-style:none;counter-reset:s;margin:0;padding:0;display:grid;gap:12px}
|
||||
.rg-route li{counter-increment:s;display:grid;grid-template-columns:40px minmax(0,1fr);gap:14px;align-items:start;padding:12px 0;border-bottom:1px solid var(--line)}
|
||||
.rg-route li:last-child{border-bottom:0}
|
||||
.rg-route li::before{content:counter(s);font:700 20px var(--display);width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(180deg,#FF7A32,var(--sig));color:#fff}
|
||||
.rg-route li::before{content:counter(s);font:700 20px var(--display);width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(180deg,#FF7A32,var(--sig));color:var(--sig-ink)}
|
||||
.rg-route h3{font:700 17px var(--display);letter-spacing:.04em;text-transform:uppercase;margin:0 0 4px;color:var(--ink)}
|
||||
.rg-route p{font-size:14px;color:var(--ink-2);margin:0 0 8px}
|
||||
.rg-where{display:flex;flex-wrap:wrap;gap:6px}
|
||||
.rg-chip{font:700 11.5px var(--body);padding:3px 10px;border-radius:999px;background:var(--accent-soft);color:var(--accent-hi);border:1px solid var(--accent-dim)}
|
||||
.rg-chip.iap{background:var(--ok-soft);color:var(--ok);border-color:#9fd9bf}
|
||||
.rg-chip.iap{background:var(--ok-soft);color:var(--ok);border-color:var(--ok-line)}
|
||||
.rg-two{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:16px}
|
||||
.rg-two .pb p{font-size:14px;color:var(--ink-2)}
|
||||
.rg-coach ul{margin:0;padding-left:20px;display:grid;gap:6px;font-size:14px;color:var(--ink-2)}
|
||||
|
||||
Reference in New Issue
Block a user