From 23dbbd8ea8f2a70909b89762fd8814bca3094fb1 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 26 Oct 2024 03:15:43 -0700 Subject: [PATCH] Create setTheme() update night-mode switch + apply dark.css --- includes/functions.php | 14 ++++++++++++-- includes/navbar.php | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 863704c0..cc5d6c99 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -801,13 +801,23 @@ function validateMac($mac) { // @return boolean function getNightmode() { - if (isset($_COOKIE['theme']) && $_COOKIE['theme'] == 'lightsout.php') { + if (isset($_COOKIE['theme']) && $_COOKIE['theme'] == 'dark.css') { return true; } else { return false; } } - + +// Sets data-bs-theme +// @return string +function setTheme() +{ + if (getNightmode()) { + echo 'data-bs-theme="dark"'; + } else { + echo 'data-bs-theme="light"'; + } +} // search array for matching string and return only first matching group function preg_only_match($pat,$haystack) { diff --git a/includes/navbar.php b/includes/navbar.php index 03966396..50050239 100755 --- a/includes/navbar.php +++ b/includes/navbar.php @@ -7,8 +7,8 @@