From 1c524efbf7da91cb99bb4516feb514071e938495 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sun, 10 Jul 2022 01:30:05 +0300 Subject: dark theme support --- engine/Skin.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engine/Skin.php') diff --git a/engine/Skin.php b/engine/Skin.php index 57f8b90..917eef7 100644 --- a/engine/Skin.php +++ b/engine/Skin.php @@ -23,11 +23,16 @@ class Skin { else $js = null; + $theme = ($_COOKIE['theme'] ?? 'auto'); + if (!in_array($theme, ['auto', 'dark', 'light'])) + $theme = 'auto'; + $layout_ctx = new SkinContext('\\skin\\base'); $lang = $this->getLang(); $lang = !empty($lang) ? json_encode($lang, JSON_UNESCAPED_UNICODE) : ''; return new Response(200, $layout_ctx->layout( static: $this->static, + theme: $theme, title: $this->title, opts: $this->options, js: $js, -- cgit v1.2.3