2603.11 added dark/light mode
This commit is contained in:
@@ -13,6 +13,20 @@
|
|||||||
--yellow: #d29922;
|
--yellow: #d29922;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] {
|
||||||
|
--bg: #ffffff;
|
||||||
|
--surface: #f6f8fa;
|
||||||
|
--border: #d0d7de;
|
||||||
|
--text: #1f2328;
|
||||||
|
--muted: #656d76;
|
||||||
|
--accent: #0969da;
|
||||||
|
--green: #1a7f37;
|
||||||
|
--red: #cf222e;
|
||||||
|
--yellow: #9a6700;
|
||||||
|
}
|
||||||
|
|
||||||
|
*, *::before, *::after { transition: background-color .2s, border-color .2s, color .2s; }
|
||||||
|
|
||||||
body { background: var(--bg); color: var(--text); font: 14px/1.6 'Segoe UI', system-ui, sans-serif; }
|
body { background: var(--bg); color: var(--text); font: 14px/1.6 'Segoe UI', system-ui, sans-serif; }
|
||||||
|
|
||||||
header {
|
header {
|
||||||
@@ -64,7 +78,7 @@ label input[type=text], label input[type=url], label input[type=password], label
|
|||||||
label input:focus { outline: none; border-color: var(--accent); }
|
label input:focus { outline: none; border-color: var(--accent); }
|
||||||
|
|
||||||
button[type=submit], .btn {
|
button[type=submit], .btn {
|
||||||
background: var(--accent); color: #0d1117; border: none; border-radius: 5px;
|
background: var(--accent); color: #fff; border: none; border-radius: 5px;
|
||||||
padding: .5rem 1.1rem; font-size: .9rem; font-weight: 600; cursor: pointer;
|
padding: .5rem 1.1rem; font-size: .9rem; font-weight: 600; cursor: pointer;
|
||||||
}
|
}
|
||||||
button[type=submit]:hover { opacity: .85; }
|
button[type=submit]:hover { opacity: .85; }
|
||||||
@@ -95,3 +109,10 @@ footer {
|
|||||||
border-top: 1px solid var(--border);
|
border-top: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
footer span { color: var(--accent); }
|
footer span { color: var(--accent); }
|
||||||
|
|
||||||
|
.theme-toggle {
|
||||||
|
background: none; border: 1px solid var(--border); border-radius: 5px;
|
||||||
|
color: var(--muted); cursor: pointer; font-size: .8rem;
|
||||||
|
padding: .2rem .55rem; line-height: 1.6;
|
||||||
|
}
|
||||||
|
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
|
||||||
|
|||||||
16
includes/theme_toggle.php
Normal file
16
includes/theme_toggle.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<button class="theme-toggle" id="theme-toggle" title="Toggle theme" onclick="
|
||||||
|
var next = document.documentElement.getAttribute('data-theme') === 'light' ? 'dark' : 'light';
|
||||||
|
document.documentElement.setAttribute('data-theme', next);
|
||||||
|
localStorage.setItem('theme', next);
|
||||||
|
this.textContent = next === 'dark' ? '☀' : '☾';
|
||||||
|
">☀</button>
|
||||||
|
<script>
|
||||||
|
(function(){
|
||||||
|
var t = localStorage.getItem('theme') || 'dark';
|
||||||
|
document.documentElement.setAttribute('data-theme', t);
|
||||||
|
document.addEventListener('DOMContentLoaded', function(){
|
||||||
|
var btn = document.getElementById('theme-toggle');
|
||||||
|
if (btn) btn.textContent = t === 'dark' ? '☀' : '☾';
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
@@ -34,6 +34,7 @@ $update_available = $upstream_version && is_newer_version($upstream_version, APP
|
|||||||
<style>
|
<style>
|
||||||
<?php include __DIR__ . '/includes/style.php'; ?>
|
<?php include __DIR__ . '/includes/style.php'; ?>
|
||||||
</style>
|
</style>
|
||||||
|
<script>document.documentElement.setAttribute('data-theme',localStorage.getItem('theme')||'dark')</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
@@ -45,6 +46,7 @@ $update_available = $upstream_version && is_newer_version($upstream_version, APP
|
|||||||
<?php if (auth_enabled()): ?>
|
<?php if (auth_enabled()): ?>
|
||||||
<a href="logout.php" style="color:var(--muted)">Sign out</a>
|
<a href="logout.php" style="color:var(--muted)">Sign out</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php include __DIR__ . '/includes/theme_toggle.php'; ?>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
.login-box form { max-width: 100%; }
|
.login-box form { max-width: 100%; }
|
||||||
.login-box button[type=submit] { width: 100%; margin-top: .25rem; }
|
.login-box button[type=submit] { width: 100%; margin-top: .25rem; }
|
||||||
</style>
|
</style>
|
||||||
|
<script>document.documentElement.setAttribute('data-theme',localStorage.getItem('theme')||'dark')</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="login-wrap">
|
<div class="login-wrap">
|
||||||
@@ -75,6 +76,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
<button type="submit">Sign in</button>
|
<button type="submit">Sign in</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="text-align:center;margin-top:.75rem">
|
||||||
|
<?php include __DIR__ . '/includes/theme_toggle.php'; ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ if (isset($_GET['edit'])) {
|
|||||||
<style>
|
<style>
|
||||||
<?php include __DIR__ . '/includes/style.php'; ?>
|
<?php include __DIR__ . '/includes/style.php'; ?>
|
||||||
</style>
|
</style>
|
||||||
|
<script>document.documentElement.setAttribute('data-theme',localStorage.getItem('theme')||'dark')</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
@@ -71,6 +72,7 @@ if (isset($_GET['edit'])) {
|
|||||||
<?php if (auth_enabled()): ?>
|
<?php if (auth_enabled()): ?>
|
||||||
<a href="logout.php" style="color:var(--muted)">Sign out</a>
|
<a href="logout.php" style="color:var(--muted)">Sign out</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php include __DIR__ . '/includes/theme_toggle.php'; ?>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ $frequent_ip_threshold = (int)get_setting('frequent_ip_threshold', '5');
|
|||||||
<style>
|
<style>
|
||||||
<?php include __DIR__ . '/includes/style.php'; ?>
|
<?php include __DIR__ . '/includes/style.php'; ?>
|
||||||
</style>
|
</style>
|
||||||
|
<script>document.documentElement.setAttribute('data-theme',localStorage.getItem('theme')||'dark')</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
@@ -69,6 +70,7 @@ $frequent_ip_threshold = (int)get_setting('frequent_ip_threshold', '5');
|
|||||||
<?php if (auth_enabled()): ?>
|
<?php if (auth_enabled()): ?>
|
||||||
<a href="logout.php" style="color:var(--muted)">Sign out</a>
|
<a href="logout.php" style="color:var(--muted)">Sign out</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php include __DIR__ . '/includes/theme_toggle.php'; ?>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
<?php
|
<?php
|
||||||
define('APP_VERSION', '2603.10');
|
define('APP_VERSION', '2603.11');
|
||||||
|
|||||||
Reference in New Issue
Block a user