site: remove light/dark theme switch — light-only theme
This commit is contained in:
@@ -57,8 +57,7 @@ const jsonLdBlocks = jsonLd
|
|||||||
{noindex && <meta name="robots" content="noindex,nofollow" />}
|
{noindex && <meta name="robots" content="noindex,nofollow" />}
|
||||||
|
|
||||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||||
<meta name="theme-color" content="#fafaf7" media="(prefers-color-scheme: light)" />
|
<meta name="theme-color" content="#fafaf7" />
|
||||||
<meta name="theme-color" content="#161613" media="(prefers-color-scheme: dark)" />
|
|
||||||
<link rel="alternate" type="application/rss+xml" title={`${SITE_NAME} — RSS`} href="/rss.xml" />
|
<link rel="alternate" type="application/rss+xml" title={`${SITE_NAME} — RSS`} href="/rss.xml" />
|
||||||
|
|
||||||
<meta property="og:type" content={ogType} />
|
<meta property="og:type" content={ogType} />
|
||||||
|
|||||||
@@ -76,16 +76,6 @@ const year = new Date().getFullYear();
|
|||||||
jsonLd={jsonLd}
|
jsonLd={jsonLd}
|
||||||
/>
|
/>
|
||||||
<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "fc978456945c49ae90a0b7e0b891ffd2"}'></script>
|
<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "fc978456945c49ae90a0b7e0b891ffd2"}'></script>
|
||||||
<script is:inline>
|
|
||||||
(function () {
|
|
||||||
try {
|
|
||||||
var t = localStorage.getItem('theme');
|
|
||||||
if (t === 'light' || t === 'dark') {
|
|
||||||
document.documentElement.setAttribute('data-theme', t);
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="masthead">
|
<header class="masthead">
|
||||||
@@ -155,19 +145,13 @@ const year = new Date().getFullYear();
|
|||||||
© {year} Unique
|
© {year} Unique
|
||||||
<span aria-hidden="true">·</span>
|
<span aria-hidden="true">·</span>
|
||||||
<a href="/legal/">Legal</a>
|
<a href="/legal/">Legal</a>
|
||||||
<span aria-hidden="true">·</span>
|
|
||||||
<a href="/settings/" class="settings-cog" aria-label="Settings">
|
|
||||||
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
||||||
<circle cx="12" cy="12" r="3"></circle>
|
|
||||||
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<style is:global>
|
<style is:global>
|
||||||
:root {
|
:root {
|
||||||
|
color-scheme: light;
|
||||||
--fg: #1a1a1a;
|
--fg: #1a1a1a;
|
||||||
--bg: #f4f0ec;
|
--bg: #f4f0ec;
|
||||||
--card-fill: #ebe6df;
|
--card-fill: #ebe6df;
|
||||||
@@ -176,24 +160,6 @@ const year = new Date().getFullYear();
|
|||||||
--rule: #e0dbd2;
|
--rule: #e0dbd2;
|
||||||
--max: 42rem;
|
--max: 42rem;
|
||||||
}
|
}
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root:not([data-theme="light"]) {
|
|
||||||
--fg: #ececea;
|
|
||||||
--bg: #161613;
|
|
||||||
--card-fill: #1f1f1c;
|
|
||||||
--muted: #8d8d88;
|
|
||||||
--accent: #ff9c5b;
|
|
||||||
--rule: #2a2a26;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
:root[data-theme="dark"] {
|
|
||||||
--fg: #ececea;
|
|
||||||
--bg: #161613;
|
|
||||||
--card-fill: #1f1f1c;
|
|
||||||
--muted: #8d8d88;
|
|
||||||
--accent: #ff9c5b;
|
|
||||||
--rule: #2a2a26;
|
|
||||||
}
|
|
||||||
* { box-sizing: border-box; }
|
* { box-sizing: border-box; }
|
||||||
html, body {
|
html, body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -263,22 +229,6 @@ const year = new Date().getFullYear();
|
|||||||
.masthead-nav a { color: var(--muted); }
|
.masthead-nav a { color: var(--muted); }
|
||||||
.masthead-nav a:hover { color: var(--accent); }
|
.masthead-nav a:hover { color: var(--accent); }
|
||||||
|
|
||||||
.settings-cog {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
color: var(--muted);
|
|
||||||
line-height: 0;
|
|
||||||
transition: color 0.18s ease, transform 0.6s ease;
|
|
||||||
}
|
|
||||||
.settings-cog:hover {
|
|
||||||
color: var(--accent);
|
|
||||||
text-decoration: none;
|
|
||||||
transform: rotate(60deg);
|
|
||||||
}
|
|
||||||
.settings-cog svg { display: block; }
|
|
||||||
|
|
||||||
.subheader {
|
.subheader {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 0.85rem 0 1rem;
|
padding: 0.85rem 0 1rem;
|
||||||
|
|||||||
@@ -1,117 +0,0 @@
|
|||||||
---
|
|
||||||
import BaseLayout from '../layouts/BaseLayout.astro';
|
|
||||||
---
|
|
||||||
|
|
||||||
<BaseLayout
|
|
||||||
title="Settings"
|
|
||||||
description="Presentation options for Unique — color theme and other display preferences."
|
|
||||||
subheader="Presentation options."
|
|
||||||
noindex
|
|
||||||
>
|
|
||||||
<article>
|
|
||||||
<section class="setting">
|
|
||||||
<h2>Color theme</h2>
|
|
||||||
<p class="hint">
|
|
||||||
Auto follows your system preference. Light or dark overrides it on this
|
|
||||||
device.
|
|
||||||
</p>
|
|
||||||
<div class="theme-toggle" role="group" aria-label="Color theme">
|
|
||||||
<button type="button" data-theme-set="auto">Auto</button>
|
|
||||||
<button type="button" data-theme-set="light">Light</button>
|
|
||||||
<button type="button" data-theme-set="dark">Dark</button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<p class="more">More presentation options will land here over time.</p>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
type Theme = 'auto' | 'light' | 'dark';
|
|
||||||
const buttons = document.querySelectorAll<HTMLButtonElement>('[data-theme-set]');
|
|
||||||
|
|
||||||
function currentTheme(): Theme {
|
|
||||||
const t = document.documentElement.getAttribute('data-theme');
|
|
||||||
return t === 'light' || t === 'dark' ? t : 'auto';
|
|
||||||
}
|
|
||||||
|
|
||||||
function setActive(value: Theme) {
|
|
||||||
for (const b of buttons) {
|
|
||||||
if (b.dataset.themeSet === value) b.setAttribute('aria-current', 'true');
|
|
||||||
else b.removeAttribute('aria-current');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyTheme(value: Theme) {
|
|
||||||
if (value === 'auto') {
|
|
||||||
document.documentElement.removeAttribute('data-theme');
|
|
||||||
try { localStorage.removeItem('theme'); } catch (e) {}
|
|
||||||
} else {
|
|
||||||
document.documentElement.setAttribute('data-theme', value);
|
|
||||||
try { localStorage.setItem('theme', value); } catch (e) {}
|
|
||||||
}
|
|
||||||
setActive(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const b of buttons) {
|
|
||||||
b.addEventListener('click', () => {
|
|
||||||
const v = b.dataset.themeSet;
|
|
||||||
if (v === 'auto' || v === 'light' || v === 'dark') applyTheme(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setActive(currentTheme());
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.setting {
|
|
||||||
padding: 1.5rem 0;
|
|
||||||
border-bottom: 1px solid var(--rule);
|
|
||||||
}
|
|
||||||
.setting:first-child { padding-top: 0; }
|
|
||||||
.setting h2 {
|
|
||||||
margin: 0 0 0.35rem;
|
|
||||||
font-size: 1.05rem;
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
margin: 0 0 0.85rem;
|
|
||||||
color: var(--muted);
|
|
||||||
font-size: 0.92rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-toggle {
|
|
||||||
display: inline-flex;
|
|
||||||
gap: 0;
|
|
||||||
border: 1px solid var(--rule);
|
|
||||||
border-radius: 999px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.theme-toggle button {
|
|
||||||
font-family: ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
font-weight: 600;
|
|
||||||
letter-spacing: 0.02em;
|
|
||||||
background: none;
|
|
||||||
border: 0;
|
|
||||||
padding: 0.45rem 1rem;
|
|
||||||
margin: 0;
|
|
||||||
color: var(--muted);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 0.18s ease, color 0.18s ease;
|
|
||||||
}
|
|
||||||
.theme-toggle button + button {
|
|
||||||
border-left: 1px solid var(--rule);
|
|
||||||
}
|
|
||||||
.theme-toggle button:hover { color: var(--accent); }
|
|
||||||
.theme-toggle button[aria-current="true"] {
|
|
||||||
background: var(--fg);
|
|
||||||
color: var(--bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.more {
|
|
||||||
margin-top: 2rem;
|
|
||||||
color: var(--muted);
|
|
||||||
font-style: italic;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</BaseLayout>
|
|
||||||
Reference in New Issue
Block a user