diff options
| author | Claude <noreply@anthropic.com> | 2026-02-18 06:04:55 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-02-18 06:04:55 +0000 |
| commit | 9f4e80dfa2d829ae33b3e5dc830034ef659befeb (patch) | |
| tree | 109cb7a8aa87f5582258611ceb9caa40e9c6edde /frontend-vanilla/src/main.ts | |
| parent | 8eb86cdc49c3c2f69d8a64f855220ebd68be336c (diff) | |
| download | neko-claude/add-css-themes-QGTmP.tar.gz neko-claude/add-css-themes-QGTmP.tar.bz2 neko-claude/add-css-themes-QGTmP.zip | |
Redesign sidebar theme controls layout and fix dark mode visibilityclaude/add-css-themes-QGTmP
Split light/dark into ☀ ☽ buttons above a horizontal rule, with
the 5 style emoji below. Increases icon size from 0.8rem to 1rem.
Replaces opacity-only approach with explicit rgba(0,0,0) color in dark
mode (sidebar remains grey in dark theme, so icons need dark ink).
Switches hover/active backgrounds to neutral rgba(128,128,128) so
they work correctly across all themes and modes.
https://claude.ai/code/session_01Jv3c8GdaDQMm5WYwHUJMVe
Diffstat (limited to 'frontend-vanilla/src/main.ts')
| -rw-r--r-- | frontend-vanilla/src/main.ts | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/frontend-vanilla/src/main.ts b/frontend-vanilla/src/main.ts index d769990..2be9354 100644 --- a/frontend-vanilla/src/main.ts +++ b/frontend-vanilla/src/main.ts @@ -77,13 +77,18 @@ export function renderLayout() { </div> <div class="sidebar-footer"> <div class="sidebar-quick-controls"> - <button id="sidebar-theme-toggle" class="sidebar-icon-btn" title="${store.theme === 'light' ? 'Switch to dark mode' : 'Switch to light mode'}">${store.theme === 'light' ? '☽' : '☀'}</button> - <span class="sidebar-controls-divider"></span> - <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'default' ? 'active' : ''}" data-style-theme="default" title="Default">○</button> - <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'refined' ? 'active' : ''}" data-style-theme="refined" title="Refined">◆</button> - <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'terminal' ? 'active' : ''}" data-style-theme="terminal" title="Terminal">▮</button> - <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'codex' ? 'active' : ''}" data-style-theme="codex" title="Codex">❧</button> - <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'sakura' ? 'active' : ''}" data-style-theme="sakura" title="Sakura">❀</button> + <div class="sidebar-controls-row"> + <button class="sidebar-icon-btn sidebar-theme-btn ${store.theme === 'light' ? 'active' : ''}" data-theme="light" title="Light mode">☀</button> + <button class="sidebar-icon-btn sidebar-theme-btn ${store.theme === 'dark' ? 'active' : ''}" data-theme="dark" title="Dark mode">☽</button> + </div> + <hr class="sidebar-controls-rule"> + <div class="sidebar-controls-row"> + <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'default' ? 'active' : ''}" data-style-theme="default" title="Default">○</button> + <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'refined' ? 'active' : ''}" data-style-theme="refined" title="Refined">◆</button> + <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'terminal' ? 'active' : ''}" data-style-theme="terminal" title="Terminal">▮</button> + <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'codex' ? 'active' : ''}" data-style-theme="codex" title="Codex">❧</button> + <button class="sidebar-icon-btn sidebar-style-btn ${store.styleTheme === 'sakura' ? 'active' : ''}" data-style-theme="sakura" title="Sakura">❀</button> + </div> </div> <a href="/v3/settings" data-nav="settings">Settings</a> <a href="#" id="logout-button">Logout</a> @@ -113,9 +118,12 @@ export function attachLayoutListeners() { logout(); }); - // Sidebar quick controls: light/dark toggle - document.getElementById('sidebar-theme-toggle')?.addEventListener('click', () => { - store.setTheme(store.theme === 'light' ? 'dark' : 'light'); + // Sidebar quick controls: light/dark buttons + document.querySelectorAll('.sidebar-theme-btn').forEach(btn => { + btn.addEventListener('click', () => { + const theme = btn.getAttribute('data-theme'); + if (theme) store.setTheme(theme); + }); }); // Sidebar quick controls: style theme emoji buttons @@ -876,12 +884,10 @@ store.on('theme-updated', () => { // Re-apply classes with proper specificity logic appEl.className = `theme-${store.theme} font-${store.fontTheme} heading-font-${store.headingFontTheme}`; } - // Update sidebar toggle icon - const toggleBtn = document.getElementById('sidebar-theme-toggle'); - if (toggleBtn) { - toggleBtn.textContent = store.theme === 'light' ? '☽' : '☀'; - toggleBtn.title = store.theme === 'light' ? 'Switch to dark mode' : 'Switch to light mode'; - } + // Update sidebar light/dark button active states + document.querySelectorAll('.sidebar-theme-btn').forEach(btn => { + btn.classList.toggle('active', btn.getAttribute('data-theme') === store.theme); + }); // Also re-render settings if we are on settings page to update active state of buttons if (router.getCurrentRoute().path === '/settings') { renderSettings(); |
