d0d5e76abe
Adds an Auto / Dark / Light radio group to the Options page that overrides the OS `prefers-color-scheme` setting. Stored in chrome.storage.local under tuner.theme. Defaults to Auto. Architecture: - src/lib/theme.js (new, ~55 lines) — getTheme/setTheme/applyTheme/initTheme helpers. applyTheme sets/removes `data-theme` attribute on <html>; initTheme reads storage + applies. - popup.js + newtab.js + options.js: call initTheme() FIRST in their init() so the theme paints before anything else. All three also listen for chrome.storage.onChanged on the THEME_KEY and live-apply changes — pick Light in Options, popup + newtab flip instantly. - options.html: new 'Appearance' card with 3 radio buttons (Auto/Dark/ Light) above the existing Playback card. - options.css: styled radio group (pill-shaped, accent border on :checked, hover state). Plus the Auto/Dark/Light CSS overrides themselves. - popup.css, newtab.css, options.css: each gets html[data-theme=light] and html[data-theme=dark] blocks that override :root vars. Attribute selector specificity beats both :root and the @media :root, so the manual override wins when set. UX: - Default = Auto (follows OS via existing @media block) - Pick Dark → overrides OS, forces dark palette - Pick Light → overrides OS, forces light palette - Selection persists across reloads, syncs across all three surfaces 7 files, ~150 lines added. No new permissions, no new dependencies. Bundled with v0.4.1-prep back-link + Phase 1 OS-follow light mode for the v0.5.0 release.
370 lines
7.5 KiB
CSS
370 lines
7.5 KiB
CSS
/* RangerHQ Tuner — Options page.
|
|
Same earthy palette as popup + newtab.
|
|
*/
|
|
|
|
:root {
|
|
--bg: #0f1411;
|
|
--bg-soft: #1a221c;
|
|
--bg-row: #1f2823;
|
|
--bg-row-hi: #2a3530;
|
|
--fg: #e8e4d4;
|
|
--fg-muted: #97a094;
|
|
--accent: #6dbf7a;
|
|
--accent-dim: #2a7d3e;
|
|
--cream: #f4e9b7;
|
|
--danger: #c9685b;
|
|
--radius: 6px;
|
|
}
|
|
|
|
/* ──────────────────────────────────────────────────────────────────────
|
|
Light mode (v0.5.0) — auto-follows OS theme. Same approach as popup
|
|
+ newtab: flip the :root vars only. Existing rules using var(--*)
|
|
carry over unchanged. Toast text + danger-button hover adjusted for
|
|
light-bg readability.
|
|
────────────────────────────────────────────────────────────────────── */
|
|
/* OS-follow light mode */
|
|
@media (prefers-color-scheme: light) {
|
|
:root {
|
|
--bg: #f6f4ed;
|
|
--bg-soft: #ece5d2;
|
|
--bg-row: #ddd6c0;
|
|
--bg-row-hi: #c8c0a8;
|
|
--fg: #2a2f28;
|
|
--fg-muted: #6a7064;
|
|
--accent: #2a7d3e;
|
|
--accent-dim: #6dbf7a;
|
|
--cream: #b8861a;
|
|
--danger: #b53a2b;
|
|
}
|
|
.opt-toast { color: #fff; }
|
|
.opt-toast[data-tone="error"] { color: #fff; }
|
|
.opt-btn--danger:hover { color: #fff; }
|
|
}
|
|
|
|
/* Manual override — force LIGHT */
|
|
html[data-theme="light"] {
|
|
--bg: #f6f4ed; --bg-soft: #ece5d2; --bg-row: #ddd6c0; --bg-row-hi: #c8c0a8;
|
|
--fg: #2a2f28; --fg-muted: #6a7064; --accent: #2a7d3e; --accent-dim: #6dbf7a;
|
|
--cream: #b8861a; --danger: #b53a2b;
|
|
}
|
|
html[data-theme="light"] .opt-toast { color: #fff; }
|
|
html[data-theme="light"] .opt-toast[data-tone="error"] { color: #fff; }
|
|
html[data-theme="light"] .opt-btn--danger:hover { color: #fff; }
|
|
|
|
/* Manual override — force DARK */
|
|
html[data-theme="dark"] {
|
|
--bg: #0f1411; --bg-soft: #1a221c; --bg-row: #1f2823; --bg-row-hi: #2a3530;
|
|
--fg: #e8e4d4; --fg-muted: #97a094; --accent: #6dbf7a; --accent-dim: #2a7d3e;
|
|
--cream: #f4e9b7; --danger: #c9685b;
|
|
}
|
|
html[data-theme="dark"] .opt-toast { color: var(--bg); }
|
|
html[data-theme="dark"] .opt-toast[data-tone="error"] { color: var(--cream); }
|
|
html[data-theme="dark"] .opt-btn--danger:hover { color: var(--cream); }
|
|
|
|
/* Theme toggle UI (v0.5.0 Phase 2) */
|
|
.opt-theme-row {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 6px;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.opt-theme-row label {
|
|
flex: 1;
|
|
min-width: 90px;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 6px;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
margin: 0;
|
|
padding: 8px 12px;
|
|
border: 1px solid var(--bg-row-hi);
|
|
border-radius: var(--radius);
|
|
background: var(--bg-row);
|
|
cursor: pointer;
|
|
transition: border-color 120ms ease-out;
|
|
}
|
|
|
|
.opt-theme-row label:hover {
|
|
border-color: var(--accent);
|
|
}
|
|
|
|
.opt-theme-row input[type="radio"] {
|
|
margin: 0;
|
|
accent-color: var(--accent);
|
|
}
|
|
|
|
.opt-theme-row label:has(input:checked) {
|
|
border-color: var(--accent);
|
|
background: var(--bg-row-hi);
|
|
}
|
|
|
|
* { box-sizing: border-box; }
|
|
|
|
html, body {
|
|
margin: 0;
|
|
padding: 0;
|
|
background: var(--bg);
|
|
color: var(--fg);
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
font-size: 14px;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.opt-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 18px 28px;
|
|
background: var(--bg-soft);
|
|
border-bottom: 1px solid #000;
|
|
}
|
|
|
|
.opt-brand {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
text-decoration: none;
|
|
color: inherit;
|
|
padding: 4px 8px;
|
|
margin: -4px -8px;
|
|
border-radius: var(--radius);
|
|
}
|
|
|
|
.opt-brand:hover {
|
|
background: var(--bg-row);
|
|
}
|
|
|
|
.opt-brand:hover .opt-back {
|
|
color: var(--accent);
|
|
transform: translateX(-2px);
|
|
}
|
|
|
|
.opt-back {
|
|
font-size: 18px;
|
|
color: var(--fg-muted);
|
|
line-height: 1;
|
|
font-weight: 400;
|
|
transition: color 120ms ease-out, transform 120ms ease-out;
|
|
}
|
|
|
|
.opt-helmet {
|
|
width: 28px;
|
|
height: 28px;
|
|
object-fit: contain;
|
|
}
|
|
|
|
.opt-brand h1 {
|
|
margin: 0;
|
|
font-size: 15px;
|
|
font-weight: 600;
|
|
letter-spacing: 0.3px;
|
|
}
|
|
|
|
.opt-version {
|
|
font-size: 11px;
|
|
color: var(--fg-muted);
|
|
letter-spacing: 0.5px;
|
|
padding: 3px 10px;
|
|
background: var(--bg-row);
|
|
border-radius: 999px;
|
|
}
|
|
|
|
.opt-main {
|
|
max-width: 680px;
|
|
margin: 0 auto;
|
|
padding: 28px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 18px;
|
|
}
|
|
|
|
.opt-card {
|
|
background: var(--bg-soft);
|
|
border: 1px solid var(--bg-row);
|
|
border-radius: var(--radius);
|
|
padding: 20px 22px;
|
|
}
|
|
|
|
.opt-card h2 {
|
|
margin: 0 0 14px;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
color: var(--accent);
|
|
}
|
|
|
|
.opt-note {
|
|
margin: 0 0 16px;
|
|
font-size: 12px;
|
|
color: var(--fg-muted);
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.opt-stats {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, 1fr);
|
|
gap: 10px;
|
|
margin-bottom: 18px;
|
|
}
|
|
|
|
.opt-stat {
|
|
padding: 10px 14px;
|
|
background: var(--bg-row);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.opt-stat-label {
|
|
font-size: 10px;
|
|
color: var(--fg-muted);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
margin-bottom: 2px;
|
|
}
|
|
|
|
.opt-stat-value {
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
.opt-row {
|
|
margin: 16px 0;
|
|
}
|
|
|
|
.opt-row label {
|
|
display: block;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.opt-row--inline {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 8px 0;
|
|
border-bottom: 1px solid var(--bg-row);
|
|
margin: 0;
|
|
}
|
|
|
|
.opt-row--inline:last-child { border-bottom: none; }
|
|
|
|
.opt-row--inline label { margin-bottom: 0; }
|
|
|
|
.opt-help {
|
|
display: block;
|
|
font-size: 11px;
|
|
font-weight: 400;
|
|
color: var(--fg-muted);
|
|
margin-top: 2px;
|
|
}
|
|
|
|
.opt-slider-wrap {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 14px;
|
|
}
|
|
|
|
#opt-cap {
|
|
flex: 1;
|
|
accent-color: var(--accent);
|
|
}
|
|
|
|
.opt-slider-value {
|
|
font-variant-numeric: tabular-nums;
|
|
font-weight: 500;
|
|
min-width: 3em;
|
|
text-align: right;
|
|
}
|
|
|
|
.opt-actions {
|
|
display: flex;
|
|
gap: 8px;
|
|
flex-wrap: wrap;
|
|
margin-top: 18px;
|
|
padding-top: 16px;
|
|
border-top: 1px solid var(--bg-row);
|
|
}
|
|
|
|
.opt-btn {
|
|
font-family: inherit;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
padding: 8px 16px;
|
|
background: var(--bg-row);
|
|
color: var(--fg);
|
|
border: 1px solid var(--bg-row-hi);
|
|
border-radius: var(--radius);
|
|
cursor: pointer;
|
|
}
|
|
|
|
.opt-btn:hover {
|
|
border-color: var(--accent);
|
|
}
|
|
|
|
.opt-btn--danger {
|
|
border-color: var(--danger);
|
|
color: var(--danger);
|
|
}
|
|
|
|
.opt-btn--danger:hover {
|
|
background: var(--danger);
|
|
color: var(--cream);
|
|
}
|
|
|
|
.opt-about {
|
|
margin: 0 0 14px;
|
|
font-size: 13px;
|
|
color: var(--fg-muted);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.opt-about a, .opt-links a {
|
|
color: var(--accent);
|
|
text-decoration: none;
|
|
border-bottom: 1px dotted transparent;
|
|
}
|
|
|
|
.opt-about a:hover, .opt-links a:hover {
|
|
border-bottom-color: var(--accent);
|
|
}
|
|
|
|
.opt-links {
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style: none;
|
|
font-size: 12px;
|
|
color: var(--fg-muted);
|
|
display: grid;
|
|
grid-template-columns: 1fr;
|
|
gap: 6px;
|
|
}
|
|
|
|
.opt-links strong {
|
|
color: var(--fg);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.opt-toast {
|
|
position: fixed;
|
|
bottom: 24px;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
background: var(--accent);
|
|
color: var(--bg);
|
|
padding: 10px 18px;
|
|
border-radius: var(--radius);
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
|
|
}
|
|
|
|
.opt-toast[data-tone="error"] {
|
|
background: var(--danger);
|
|
color: var(--cream);
|
|
}
|