Respect site cfg_json theme on first-run; add user_theme_selected flag; set flag when user selects theme or URL param

This commit is contained in:
Scott Idem
2026-04-08 16:38:12 -04:00
parent 32ed4e47a8
commit fec08fdfbf
4 changed files with 20 additions and 31 deletions

View File

@@ -316,9 +316,14 @@ $effect(() => {
const url_theme = data.url.searchParams.get('theme');
const url_theme_mode = data.url.searchParams.get('theme_mode');
if (url_theme || url_theme_mode) {
if (url_theme) $ae_loc.theme_name = url_theme;
if (url_theme_mode === 'light' || url_theme_mode === 'dark')
$ae_loc.theme_mode = url_theme_mode;
if (url_theme) {
// Mark that the user (or URL) explicitly chose a theme so site defaults
// won't overwrite it later on subsequent loads.
ae_loc.update((l: any) => ({ ...l, theme_name: url_theme, user_theme_selected: true }));
}
if (url_theme_mode === 'light' || url_theme_mode === 'dark') {
ae_loc.update((l: any) => ({ ...l, theme_mode: url_theme_mode }));
}
const clean_url = new URL(data.url.href);
clean_url.searchParams.delete('theme');
clean_url.searchParams.delete('theme_mode');