mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Create setTheme() update night-mode switch + apply dark.css
This commit is contained in:
parent
80fbb9aaed
commit
23dbbd8ea8
@ -801,13 +801,23 @@ function validateMac($mac) {
|
|||||||
// @return boolean
|
// @return boolean
|
||||||
function getNightmode()
|
function getNightmode()
|
||||||
{
|
{
|
||||||
if (isset($_COOKIE['theme']) && $_COOKIE['theme'] == 'lightsout.php') {
|
if (isset($_COOKIE['theme']) && $_COOKIE['theme'] == 'dark.css') {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
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
|
// search array for matching string and return only first matching group
|
||||||
function preg_only_match($pat,$haystack)
|
function preg_only_match($pat,$haystack)
|
||||||
{
|
{
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
<ul class="navbar-nav ms-auto ms-md-0 me-2 me-lg-4">
|
<ul class="navbar-nav ms-auto ms-md-0 me-2 me-lg-4">
|
||||||
<!-- Display mode -->
|
<!-- Display mode -->
|
||||||
<div class="form-check form-switch p-4 mt-1">
|
<div class="form-check form-switch p-4 mt-1">
|
||||||
<input type="checkbox" class="form-check-input" id="darkModeSwitch" <?php echo getNightmode() ? 'checked' : null ; ?> >
|
<input type="checkbox" class="form-check-input" id="night-mode" <?php echo getNightmode() ? 'checked' : null ; ?> >
|
||||||
<label class="form-check-label" for="darkModeSwitch"><i class="far fa-moon mr-1 text-muted"></i></label>
|
<label class="form-check-label" for="night-mode"><i class="far fa-moon mr-1 text-muted"></i></label>
|
||||||
</div>
|
</div>
|
||||||
<!-- Auth user -->
|
<!-- Auth user -->
|
||||||
<li class="nav-item mt-1">
|
<li class="nav-item mt-1">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user