Files
rangerhq-tuner/src/options/options.css
T
ranger 529409eed9 feat(v0.5.3-prep): user-customizable Quick Stations + descriptions
David flagged 2026-06-10: '14 stations wraps 3 lines, original idea
was 2 lines tidy, but now thought of user selecting themselves' +
'maybe have a description of each station' + 'be great to keep the
code clean.'

Architecture: pure data, not code. Adds tuner.quickStations as a
new chrome.storage.local key. Default 8 (tidy 2-row layout per the
v0.4.0 picks). User can pick any subset of the 46 SomaFM channels
via a new Options page card.

NEW FILE
  src/lib/quick-stations.js — DEFAULT_QUICK_IDS + storage helpers
  (getQuickStations, setQuickStations, resetQuickStations) with the
  same defensive 'fall back if chrome.storage missing' pattern as
  history.js + theme.js.

CHANGED
  src/newtab/newtab.js — removed hardcoded QUICK_IDS array, replaced
  with module-level 'let quickIds = []' populated during init from
  getQuickStations() + re-loaded when chrome.storage.onChanged fires
  on tuner.quickStations. renderQuick() now uses module-level
  quickIds and shows 'No Quick Stations picked — set some in
  Settings' empty state if the array is empty.

  src/options/options.html — new 'Quick Stations' card between
  Appearance and Playback. Contains: helper text + selected-count
  badge + scrollable <ul> + Reset-to-defaults button.

  src/options/options.css — ~90 lines for the new picker: scrollable
  list (max-height 360px), checkbox-name-description row layout,
  accent-coloured count badge, subtle hover background, brand-styled
  scrollbar.

  src/options/options.js — initQuickStationsUI() reads cached
  channel list from tuner.stationsCache, sorts alphabetically, builds
  one row per channel with checkbox + name + genre pill + description.
  Toggle handler writes the current pick set to chrome.storage.local.
  Reset button confirms then calls resetQuickStations() + re-checks
  boxes to match defaults. Cross-surface sync via storage.onChanged
  re-syncs check state if changes happen elsewhere.

5 files (1 new), ~250 lines added. No new permissions, no new
dependencies.
2026-06-10 01:02:56 +01:00

467 lines
9.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);
}
/* ──────────────────────────────────────────────────────────────────────
Quick Stations picker (v0.5.3) — scrollable checkbox list of every
SomaFM channel. Toggles persist to chrome.storage.local under
tuner.quickStations; NewTab re-renders chip row instantly.
────────────────────────────────────────────────────────────────────── */
.opt-qs-count {
color: var(--accent);
font-weight: 500;
}
.opt-qs-list {
margin: 12px 0 0;
padding: 0;
list-style: none;
max-height: 360px;
overflow-y: auto;
border: 1px solid var(--bg-row);
border-radius: var(--radius);
background: var(--bg-row);
}
.opt-qs-list::-webkit-scrollbar {
width: 8px;
}
.opt-qs-list::-webkit-scrollbar-thumb {
background: var(--bg-row-hi);
border-radius: 4px;
}
.opt-qs-list::-webkit-scrollbar-track {
background: transparent;
}
.opt-qs-loading {
padding: 14px;
text-align: center;
color: var(--fg-muted);
font-size: 12px;
}
.opt-qs-row {
border-bottom: 1px solid var(--bg-soft);
}
.opt-qs-row:last-child {
border-bottom: none;
}
.opt-qs-label {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 10px 14px;
margin: 0;
cursor: pointer;
font-weight: 400;
}
.opt-qs-label:hover {
background: var(--bg-row-hi);
}
.opt-qs-label input[type="checkbox"] {
margin: 3px 0 0 0;
accent-color: var(--accent);
flex-shrink: 0;
width: 14px;
height: 14px;
cursor: pointer;
}
.opt-qs-main {
flex: 1;
min-width: 0;
}
.opt-qs-name {
font-size: 13px;
font-weight: 500;
color: var(--fg);
}
.opt-qs-genre {
font-size: 10px;
color: var(--accent);
text-transform: uppercase;
letter-spacing: 0.5px;
margin-top: 2px;
}
.opt-qs-desc {
font-size: 11px;
color: var(--fg-muted);
margin-top: 3px;
line-height: 1.4;
}