U-Navigator
diff --git a/server/public/app.js b/server/public/app.js
index 3e23527..2cbc1f0 100644
--- a/server/public/app.js
+++ b/server/public/app.js
@@ -4,6 +4,7 @@ const statusText = document.querySelector('#statusText');
const transferButton = document.querySelector('#newQueueButton');
const settingsButton = document.querySelector('#settingsButton');
const API_BASE = window.UNAV_API_BASE || '/api';
+applyHostTheme();
const APP_VERSION = window.UNAV_VERSION || 'dev';
const state = {
config: null,
@@ -4067,3 +4068,20 @@ function contextMenuActions(win, entry) {
}
return actions;
}
+
+// Unraid normally tells us its theme (data-theme from the .page). If it does not,
+// look at the page background around the navigator so custom/unknown themes still match.
+function applyHostTheme() {
+ if (!appShell || appShell.dataset.theme) return;
+ let element = appShell.parentElement;
+ while (element) {
+ const match = getComputedStyle(element).backgroundColor.match(/rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)(?:,\s*([\d.]+))?/);
+ if (match && (match[4] === undefined || Number(match[4]) > 0.5)) {
+ const [r, g, b] = match.slice(1, 4).map(Number);
+ const luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
+ appShell.dataset.theme = luminance < 0.5 ? 'dark' : 'light';
+ return;
+ }
+ element = element.parentElement;
+ }
+}
diff --git a/server/public/styles.css b/server/public/styles.css
index 0beee70..1ec0773 100644
--- a/server/public/styles.css
+++ b/server/public/styles.css
@@ -20,8 +20,25 @@
position: relative;
}
+/* Dark palette: set from the Unraid theme (data-theme), or from the OS when the theme is unknown. */
+.u-nav[data-theme="dark"] {
+ --bg: #101418;
+ --surface: #1b2229;
+ --surface-2: #222b33;
+ --surface-3: #2b3741;
+ --text: #eef3f7;
+ --muted: #a3b0bd;
+ --line: #36434f;
+ --shadow: 0 18px 55px rgba(0, 0, 0, 0.44);
+ color-scheme: dark;
+}
+
+.u-nav[data-theme="light"] {
+ color-scheme: light;
+}
+
@media (prefers-color-scheme: dark) {
- .u-nav {
+ .u-nav:not([data-theme]) {
--bg: #101418;
--surface: #1b2229;
--surface-2: #222b33;
@@ -30,6 +47,7 @@
--muted: #a3b0bd;
--line: #36434f;
--shadow: 0 18px 55px rgba(0, 0, 0, 0.44);
+ color-scheme: dark;
}
}
diff --git a/u-navigator.plg b/u-navigator.plg
index 248e85a..cc7f911 100644
--- a/u-navigator.plg
+++ b/u-navigator.plg
@@ -1,7 +1,7 @@
-
+
@@ -18,6 +18,7 @@
&description;
### &version;
+- Folgt dem Unraid-Theme (black/gray dunkel, white/azure hell) statt nur der Systemeinstellung.
- Neuer Ordner, Tastaturbedienung, Kopieren/Ausschneiden/Einfügen, Zurück/Vorwärts, anklickbare Pfadleiste.
- Filter und rekursive Suche, Favoriten, Vorschaubilder, Nebeneinander-Ansicht, Statusleiste mit freiem Speicher.
- Konfliktdialog (Ersetzen/Beide behalten/Überspringen), Transfers mit Geschwindigkeit, Restzeit und Abbrechen.
@@ -27,7 +28,7 @@
https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;
-40d12d856aa3b87edb163e91345d2310
+39df497b7df11629b3e857c896c48bfc
diff --git a/u-navigator.plg.in b/u-navigator.plg.in
index 3f35672..e500cd2 100644
--- a/u-navigator.plg.in
+++ b/u-navigator.plg.in
@@ -18,6 +18,7 @@
&description;
### &version;
+- Folgt dem Unraid-Theme (black/gray dunkel, white/azure hell) statt nur der Systemeinstellung.
- Neuer Ordner, Tastaturbedienung, Kopieren/Ausschneiden/Einfügen, Zurück/Vorwärts, anklickbare Pfadleiste.
- Filter und rekursive Suche, Favoriten, Vorschaubilder, Nebeneinander-Ansicht, Statusleiste mit freiem Speicher.
- Konfliktdialog (Ersetzen/Beide behalten/Überspringen), Transfers mit Geschwindigkeit, Restzeit und Abbrechen.