From 9d33f2ded85c07ee9da863098ca741347f93201e Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 18 Oct 2023 18:49:54 +0200 Subject: [PATCH] Fix the `theme-color` in the admin panel --- .../install/files/acp/templates/header.tpl | 24 ++++++++++++------- .../lib/system/style/StyleCompiler.class.php | 3 +++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/header.tpl b/wcfsetup/install/files/acp/templates/header.tpl index dde2ef0721..d85f3bf8d5 100644 --- a/wcfsetup/install/files/acp/templates/header.tpl +++ b/wcfsetup/install/files/acp/templates/header.tpl @@ -23,14 +23,27 @@ - {else} - {/if} + @@ -49,13 +62,6 @@ {* This constant is a compiler option, it does not exist in production. *} {* Unlike the frontend, this option must be defined in the ACP at all times. *} var COMPILER_TARGET_DEFAULT = true; - - {if $__wcf->getStyleHandler()->getColorScheme() === 'system'} - { - const colorScheme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; - document.documentElement.dataset.colorScheme = colorScheme; - } - {/if} diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index 16b917d2fa..9cd20e687a 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -433,6 +433,9 @@ final class StyleCompiler extends SingletonFactory $variables = $this->prepareVariables($variables); + // The theme color implicitly matches the header background color. + $variables['wcfPageThemeColor'] = 'var(--wcfHeaderBackground)'; + $scss = "/*!\n\nstylesheet for the admin panel, generated on " . \gmdate('r') . " -- DO NOT EDIT\n\n*/\n"; $scss .= $this->bootstrap($variables); foreach ($files as $file) { -- 2.20.1