Replace lightsout.php w/ dark.css, set data-bs-theme

This commit is contained in:
billz 2024-10-26 03:17:52 -07:00
parent eb3873ac3f
commit 3004ce49cc
3 changed files with 16 additions and 379 deletions

View file

@ -1,374 +0,0 @@
<?php header("Content-Type: text/css; charset=utf-8"); ?>
<?php
require_once '../../includes/functions.php';
$color = getColorOpt();
?>
/*
Theme Name: Lights Out
Author: @billz
Author URI: https://github.com/billz
Description: A dark mode theme for RaspAP
License: GNU General Public License v3.0
*/
<?php
// Base color
$baseColor = $color;
$textColor = lightenColor($baseColor, 95);
$secondaryColor = lightenColor($baseColor, 30);
?>
@import url('all.css');
html * {
font-family: Helvetica,Arial,sans-serif;
color: #afafaf;
}
h2 {
font-size: 2rem !important;
}
.page-header {
border-left: .01rem solid #d2d2d2;
border-bottom: .01rem solid #d2d2d2;
}
.sidebar-light .nav-item.active .nav-link i {
color: <?php echo $secondaryColor; ?>;
}
.sidebar .nav-item.active .nav-link {
font-weight: 400;
}
.sidebar-brand-text {
color: <?php echo $color; ?>;
}
#wrapper #content-wrapper #content {
background-color: #202020;
}
.topbar {
background-color: #202020;
}
.nav-tabs {
border-bottom: 1px solid #404040;
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-link {
font-size: 1.0rem;
}
.nav-link.active {
font-weight: bolder;
}
.nav-tabs .nav-link:hover {
border-color: transparent;
}
.navbar-default .navbar-brand:hover {
color: #d2d2d2;
}
.navbar-default .navbar-toggle {
border-color: #d2d2d2;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #d2d2d2;
}
.navbar-default .navbar-toggle:focus,
.navbar-default .navbar-toggle:hover {
background-color: #202020;
}
#content, .navbar, .sidebar, .footer, .sticky-footer {
background-attachment: scroll;
background-repeat: repeat;
background-size: auto;
background-position: 0 0;
background-origin: padding-box;
background-clip: border-box;
}
.sticky-footer {
background-position: 30px 0;
}
.sidebar {
background-position: 0 20px;
}
.nav-tabs .nav-link.active {
color: #d2d2d2;
background-color: #141414;
border-color: #404040 #404040 #141414;
}
a:focus, a:hover {
color: #d2d2d2;
}
.card>.card-header, .modal-content, .modal-header {
border-color: #404040;
background-color: #202020;
color: #afafaf;
border-top-right-radius: 0.35rem;
border-top-left-radius: 0.35rem;
font-size: 1.0rem;
font-weight: 400;
}
.modal-body {
background-color: #141414;
}
.card>.card-header .fa {
color: #202020;
}
.card-header [class^="fa"] {
color: #afafaf;
font-size: 1.0rem;
}
.col {
color: #afafaf;
}
.card, .card-body {
border-color: #343434;
border-radius: 0.35rem;
background-color: #141414;
}
hr {
border-top: .01rem solid #d2d2d2;
}
.ra-raspap:before {
color: #ac1b3d !important;
}
.sidebar-light #sidebarToggle {
background-color: #202020;
border: 1px solid #afafaf !important
}
.sidebar-light #sidebarToggle::after {
color: #afafaf;
}
.sidebar-light .nav-item .nav-link:hover i {
color: #d2d2d2;
}
.sidebar-light #sidebarToggle:hover {
background-color: #202020;
}
.sidebar.toggled .nav-item .nav-link span {
display: none;
}
.sidebar.toggled .nav-item .nav-link {
text-align: center;
padding: .6rem 1rem;
width: 6.5rem;
}
.card-footer, .modal-footer {
background-color: #202020;
border-top: 0px;
}
.modal-footer {
border-radius: 0.3rem;
}
.card>.card-header::before, .navbar-default::before {
content: " ";
display: block;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 2;
background-size: 100% 2px, 3px 100%;
pointer-events: none;
}
.sidebar-light, .sticky-footer {
background-color: #202020;
}
.sidebar-light .nav-item .nav-link i {
color: <?php echo $color; ?>
}
.sidebar .nav-item .nav-link {
padding: 0.6rem;
padding-left: 1.2rem;
}
.sidebar-light hr.sidebar-divider {
border-top: 1px solid #404040;
padding-top: 0.5rem;
}
.sidebar .nav-item .nav-link span {
font-size: 1.0rem;
}
.topbar .topbar-divider {
border-right: 1px solid #404040;
}
.label-warning {
background-color: #d2d2d2;
}
span.label.label-warning {
color: #202020;
}
.table>tbody>tr>td,
.table>tbody>tr>th,
.table>tfoot>tr>td,
.table>tfoot>tr>th,
.table>thead>tr>td,
.table>thead>tr>th {
background-color: #202020;
border-top: .01rem solid #202020;
}
.table>thead>tr>th {
vertical-align: bottom;
border-bottom: .01rem solid #d2d2d2;
}
[class*="btn"], [class*="btn"]:focus, [class*="btn"]:disabled {
background-color: #202020;
border-color: #404040;
border-radius: 0.35rem;
color: #d2d2d2;
}
[class*="btn"]:hover {
border-radius: 3px;
color: #d2d2d2;
background-color: #202020;
border-color: #afafaf;
}
[class*="btn"]:hover .disabled {
background-color:red;
}
[class*="alert"] {
border-radius: .35rem;
color: #d2d2d2;
background-color: #202020;
border: 1px solid #404040;
}
.close {
font-size: 1.2em;
font-weight: 400;
text-shadow: none;
color: #d2d2d2;
}
.form-control,
.form-control:focus,
.custom-select {
color: #d2d2d2;
background-color: #202020;
border: 1px solid #404040;
border-radius: 3px;
}
.form-control:disabled,
.form-control[readonly] {
background-color: #202020;
opacity: 0.5;
}
.form-control::-webkit-input-placeholder { color: #d2d2d2; }
.form-control:-moz-placeholder { color: #d2d2d2; }
.form-control::-moz-placeholder { color: #d2d2d2; }
.form-control:-ms-input-placeholder { color: #d2d2d2; }
.form-control::-ms-input-placeholder { color: #d2d2d2; }
input[type="text"]{
color: #d2d2d2 !important
}
.progress {
background-color: #202020;
border-radius: 0px;
}
.progress-bar {
color: #202020;
}
.progress-bar.progress-bar-info.progress-bar-striped.active {
background-color: #d2d2d2;
}
.figure-img {
filter: opacity(0.7);
}
.ra-wireguard:hover:before {
color: #d1d3e2 !important;
}
.sidebar-light .nav-link span.ra-wireguard:before {
color: <?php echo $color; ?>!important;
}
.sidebar-light .nav-item.active .nav-link span.ra-wireguard:before {
color: <?php echo $textColor; ?>;
}
.logoutput {
background-color: #202020;
border-color: #404040;
}
.text-muted {
font-size: 0.8rem;
}
.fas.fa-circle {
font-size: 0.7rem;
}
pre {
background-color: #202020;
border: #202020;
}
button.btn.btn-light.js-toggle-password {
border: 1px solid #343434;
}
.btn-light {
border-color: #343434;
border-radius: 0.35rem;
background-color: #141414;
}
.signal-icon .signal-bar {
background: #2b8080;
}

View file

@ -759,7 +759,7 @@ $(function() {
if (nightModeChecked && hasDarkTheme) {
if (theme === "custom.php") {
set_theme("lightsout.php");
set_theme("dark.css");
}
} else {
set_theme(theme);
@ -776,7 +776,7 @@ function set_theme(theme) {
$(function() {
var currentTheme = getCookie('theme');
// Check if the current theme is a dark theme
var isDarkTheme = currentTheme === 'lightsout.php';
var isDarkTheme = currentTheme === 'dark.css';
$('#night-mode').prop('checked', isDarkTheme);
$('#night-mode').change(function() {
@ -785,10 +785,10 @@ $(function() {
if (state == true) {
if (currentTheme == 'custom.php') {
set_theme('lightsout.php');
set_theme('dark.css');
}
} else {
if (currentTheme == 'lightsout.php') {
if (currentTheme == 'dark.css') {
set_theme('custom.php');
}
}
@ -855,6 +855,17 @@ $(window).bind("load", function() {
}).parent().addClass('active');
});
$(document).ready(function() {
const $htmlElement = $('html');
const $modeswitch = $('#night-mode');
$modeswitch.on('change', function() {
const isChecked = $(this).is(':checked');
const newTheme = isChecked ? 'dark' : 'light';
$htmlElement.attr('data-bs-theme', newTheme);
localStorage.setItem('bsTheme', newTheme);
});
});
$(document)
.ajaxSend(setCSRFTokenHeader)
.ready(contentLoaded)

View file

@ -53,7 +53,7 @@ require_once 'includes/torproxy.php';
initializeApp();
?>
<!DOCTYPE html>
<html lang="en">
<html lang="en" <?php setTheme();?>>
<head>
<meta charset="utf-8">
<?php echo CSRFMetaTag() ?>