fix: header theme toggle now uses themes.js toggleThemeMode
CI / lint (push) Failing after 24s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Failing after 15s

- toggleTheme() in ui.js now calls toggleThemeMode() from themes.js
- This properly toggles dark/light within the current named theme
- Updates the theme label and icon after mode change
This commit is contained in:
2026-06-19 07:40:42 -04:00
parent c51bf0eab0
commit 8e0ca92161
+16 -2
View File
@@ -7,6 +7,7 @@ import { syncActiveFileTreeItem, refreshSidebarTreePreservingState } from './sid
import { GraphViewManager } from './graph.js';
import { DashboardConflictsWidget } from './dashboard.js';
import { t, tr } from './i18n.js';
import { toggleThemeMode } from './themes.js';
// ---------------------------------------------------------------------------
// Right Sidebar Manager
// ---------------------------------------------------------------------------
@@ -172,8 +173,21 @@ export function applyTheme(theme) {
}
export function toggleTheme() {
const current = document.documentElement.getAttribute("data-theme");
applyTheme(current === "dark" ? "light" : "dark");
const newMode = toggleThemeMode();
// Update the theme toggle label
const themeLabel = document.getElementById("theme-label");
if (themeLabel) {
themeLabel.textContent = newMode === "dark" ? t('theme.dark') : t('theme.light');
}
// Update the theme toggle icon
const themeBtn = document.getElementById("theme-toggle");
if (themeBtn) {
const icon = themeBtn.querySelector("i");
if (icon) {
icon.setAttribute("data-lucide", newMode === "dark" ? "moon" : "sun");
}
}
safeCreateIcons();
}
export function initHeaderMenu() {