fix: header theme toggle now uses themes.js toggleThemeMode
- 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:
+16
-2
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user