Sets the application theme to the specified mode and updates the DOM and local storage.
The new theme mode to set ("dark", "light", or "system").
A promise that resolves to true if dark mode is enabled, false otherwise.
Also dispatches a "themeToggled" event on the document.
export async function setTheme(newTheme: ThemeMode) { // Delegate to the explicit mode methods for clarity and single-responsibility switch (newTheme) { case "dark": return enableDarkMode(); case "light": return enableLightMode(); case "system": default: return applySystemTheme(); }} Copy
export async function setTheme(newTheme: ThemeMode) { // Delegate to the explicit mode methods for clarity and single-responsibility switch (newTheme) { case "dark": return enableDarkMode(); case "light": return enableLightMode(); case "system": default: return applySystemTheme(); }}
Sets the application theme to the specified mode and updates the DOM and local storage.