diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index 1c3a5b74f28..d85341947e5 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -22,16 +22,9 @@ var COMPILER_TARGET_DEFAULT = {if !VISITOR_USE_TINY_BUILD || $__wcf->user->userID}true{else}false{/if}; {/if} - {if $__wcf->getStyleHandler()->getStyle()->hasDarkMode} + {if $__wcf->getStyleHandler()->getColorScheme() === 'system'} { - let colorScheme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; - try { - const value = localStorage.getItem("wsc_colorScheme"); - if (value === "light" || value === "dark") { - colorScheme = value; - } - } catch {} - + const colorScheme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; document.documentElement.dataset.colorScheme = colorScheme; } {/if} @@ -82,7 +75,7 @@ window.addEventListener('pageshow', function(event) { url: '{link controller="BackgroundQueuePerform"}{/link}', force: {if $forceBackgroundQueuePerform|isset}true{else}false{/if} }, - colorScheme: '{@$__wcf->getStyleHandler()->getColorScheme()|encodeJS}', + dynamicColorScheme: {if $__wcf->getStyleHandler()->getColorScheme() === 'system'}true{else}false{/if}, enableUserPopover: {if $__wcf->getSession()->getPermission('user.profile.canViewUserProfile')}true{else}false{/if}, executeCronjobs: {if $executeCronjobs}'{link controller="CronjobPerform"}{/link}'{else}undefined{/if}, {if ENABLE_SHARE_BUTTONS} diff --git a/com.woltlab.wcf/templates/pageFooter.tpl b/com.woltlab.wcf/templates/pageFooter.tpl index 00301f3642b..bdf5b1abed6 100644 --- a/com.woltlab.wcf/templates/pageFooter.tpl +++ b/com.woltlab.wcf/templates/pageFooter.tpl @@ -24,28 +24,14 @@ {assign var=__showStyleChanger value=false} {/if} - {if $__boxesFooter|count || !$boxesFooter|empty || $__showStyleChanger || $__wcf->getStyleHandler()->showColorSchemeSelector()} + {if $__boxesFooter|count || !$boxesFooter|empty || $__showStyleChanger}
-
- {hascontent} +
+ {if $__showStyleChanger}
- {content} - {if $__showStyleChanger} - - {/if} - {if $__wcf->getStyleHandler()->showColorSchemeSelector()} - - {/if} - {/content} +
- {/hascontent} + {/if} {hascontent}
{content} diff --git a/com.woltlab.wcf/templates/settings.tpl b/com.woltlab.wcf/templates/settings.tpl index 481070105f0..f0d0f64b200 100644 --- a/com.woltlab.wcf/templates/settings.tpl +++ b/com.woltlab.wcf/templates/settings.tpl @@ -64,10 +64,10 @@ {/if} - {if $availableStyles|count > 1} -
-

{lang}wcf.user.styles{/lang}

+
+

{lang}wcf.user.styles{/lang}

+ {if $availableStyles|count > 1}
@@ -80,10 +80,22 @@ {lang}wcf.user.style.description{/lang}
- - {event name='styleFields'} -
- {/if} + {/if} + +
+
+
+ + {lang}wcf.user.style.colorScheme.description{/lang} +
+
+ + {event name='styleFields'} +
{if MODULE_TROPHY && $__wcf->getSession()->getPermission('user.profile.trophy.maxUserSpecialTrophies') > 0 && $availableTrophies|count}
diff --git a/com.woltlab.wcf/userOption.xml b/com.woltlab.wcf/userOption.xml index 549330a9b67..8afa12b4aa2 100644 --- a/com.woltlab.wcf/userOption.xml +++ b/com.woltlab.wcf/userOption.xml @@ -156,6 +156,14 @@ boolean 1 +