feat: wire up class-based dark mode for Tailwind v4
- app.css: add @custom-variant dark so Tailwind v4 respects .dark class on <html> instead of always following OS prefers-color-scheme. - app.html: remove hardcoded class="light" (now set dynamically). - +layout.svelte: toggle .dark/.light on <html> when ae_loc.theme_mode changes. - e_app_theme.svelte: related theme toggle changes.
This commit is contained in:
@@ -149,13 +149,7 @@ if ($ae_loc.app_cfg.theme_mode == 'light') {
|
||||
$ae_loc.theme_mode = 'light';
|
||||
}
|
||||
|
||||
if ($ae_loc.theme_mode == 'light') {
|
||||
document.documentElement.classList.remove('dark');
|
||||
document.documentElement.classList.add('light');
|
||||
} else if ($ae_loc.theme_mode == 'dark') {
|
||||
document.documentElement.classList.remove('light');
|
||||
document.documentElement.classList.add('dark');
|
||||
}
|
||||
// DOM sync is handled reactively by the layout effect in +layout.svelte
|
||||
}}
|
||||
title="Change light and dark mode"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user