diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-17 15:06:42 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-17 15:06:42 -0800 |
| commit | 95ed6be5c6539d3b5c44fd8505f82cf0e45a7ebc (patch) | |
| tree | f28828784e45dc4073b5176d6585c83bc1f8d27e /frontend-vanilla/src/main.ts | |
| parent | 7ad8d0079a09e234cb1b01db47957b16e36c8c07 (diff) | |
| download | neko-95ed6be5c6539d3b5c44fd8505f82cf0e45a7ebc.tar.gz neko-95ed6be5c6539d3b5c44fd8505f82cf0e45a7ebc.tar.bz2 neko-95ed6be5c6539d3b5c44fd8505f82cf0e45a7ebc.zip | |
Refine Settings UI: Fix dark mode text colors, split font controls for headers and body, update monospace stack, and soft-deprecate tags
Diffstat (limited to 'frontend-vanilla/src/main.ts')
| -rw-r--r-- | frontend-vanilla/src/main.ts | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/frontend-vanilla/src/main.ts b/frontend-vanilla/src/main.ts index 4e1d216..62a47cc 100644 --- a/frontend-vanilla/src/main.ts +++ b/frontend-vanilla/src/main.ts @@ -23,7 +23,8 @@ let appEl: HTMLDivElement | null = null; export function renderLayout() { appEl = document.querySelector<HTMLDivElement>('#app'); if (!appEl) return; - appEl.className = `theme-${store.theme} font-${store.fontTheme}`; + // Apply both font themes (font-* for body, heading-font-* for headers) + appEl.className = `theme-${store.theme} font-${store.fontTheme} heading-font-${store.headingFontTheme}`; appEl.innerHTML = ` <div class="layout ${store.sidebarVisible ? 'sidebar-visible' : 'sidebar-hidden'}"> <button class="sidebar-toggle" id="sidebar-toggle-btn" title="Toggle Sidebar">🐱</button> @@ -394,6 +395,15 @@ export function renderSettings() { </div> </div> <div class="settings-group" style="margin-top: 1rem;"> + <label>Heading Font</label> + <select id="heading-font-selector" style="margin-bottom: 1rem;"> + <option value="default" ${store.headingFontTheme === 'default' ? 'selected' : ''}>System (Helvetica Neue)</option> + <option value="serif" ${store.headingFontTheme === 'serif' ? 'selected' : ''}>Serif (Georgia)</option> + <option value="sans" ${store.headingFontTheme === 'sans' ? 'selected' : ''}>Sans-Serif (Inter/System)</option> + <option value="mono" ${store.headingFontTheme === 'mono' ? 'selected' : ''}>Monospace</option> + </select> + + <label>Body Font</label> <select id="font-selector"> <option value="default" ${store.fontTheme === 'default' ? 'selected' : ''}>Default (Palatino)</option> <option value="serif" ${store.fontTheme === 'serif' ? 'selected' : ''}>Serif (Georgia)</option> @@ -444,7 +454,12 @@ export function renderSettings() { } }); - // Font + // Heading Font + document.getElementById('heading-font-selector')?.addEventListener('change', (e) => { + store.setHeadingFontTheme((e.target as HTMLSelectElement).value); + }); + + // Body Font document.getElementById('font-selector')?.addEventListener('change', (e) => { store.setFontTheme((e.target as HTMLSelectElement).value); }); @@ -807,7 +822,12 @@ store.on('search-updated', () => { store.on('theme-updated', () => { if (!appEl) appEl = document.querySelector<HTMLDivElement>('#app'); if (appEl) { - appEl.className = `theme-${store.theme} font-${store.fontTheme}`; + // Re-apply classes with proper specificity logic + appEl.className = `theme-${store.theme} font-${store.fontTheme} heading-font-${store.headingFontTheme}`; + } + // Also re-render settings if we are on settings page to update active state of buttons + if (router.getCurrentRoute().path === '/settings') { + renderSettings(); } }); |
