improved dark mode, automatic theme switch (#5720)

This commit is contained in:
Kevin Papst
2025-12-19 23:51:27 +01:00
committed by GitHub
parent b61420d633
commit 8c1ed68817
90 changed files with 1855 additions and 1956 deletions

View File

@@ -10,9 +10,7 @@
namespace App\EventSubscriber;
use App\Configuration\LocaleService;
use App\Constants;
use App\Entity\User;
use App\Entity\UserPreference;
use KevinPapst\TablerBundle\Helper\ContextHelper;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\KernelEvent;
@@ -46,8 +44,6 @@ final class ThemeOptionsSubscriber implements EventSubscriberInterface
return;
}
$this->helper->setAssetVersion((string) Constants::VERSION_ID);
if ($this->localeService->isRightToLeft($event->getRequest()->getLocale())) {
$this->helper->setIsRightToLeft(true);
}
@@ -63,9 +59,14 @@ final class ThemeOptionsSubscriber implements EventSubscriberInterface
return;
}
$skin = $user->getPreferenceValue(UserPreference::SKIN);
$skin = $user->getSkin();
if ($skin === 'dark') {
$this->helper->setIsDarkMode(true);
} elseif ($skin === 'auto') {
$this->helper->setThemeAuto(true);
} else {
$this->helper->setIsDarkMode(false);
$this->helper->setThemeAuto(false);
}
// do not allow boxed layout, header is not compatible and other functions need the full size as well