diff --git a/build-plugin.sh b/build-plugin.sh index a8b12ca..d3026e7 100755 --- a/build-plugin.sh +++ b/build-plugin.sh @@ -5,7 +5,7 @@ set -eu export COPYFILE_DISABLE=1 PLUGIN="u-navigator" -VERSION="2026.11.21.r003" +VERSION="2026.11.21.r004" PKG_DIR="packages" WORK_DIR=".plugin-build" PKG_NAME="${PLUGIN}-${VERSION}.tgz" diff --git a/packages/u-navigator-2026.11.21.r004.tgz b/packages/u-navigator-2026.11.21.r004.tgz new file mode 100644 index 0000000..eb0dc76 Binary files /dev/null and b/packages/u-navigator-2026.11.21.r004.tgz differ diff --git a/plugin-root/usr/local/emhttp/plugins/u-navigator/U-Navigator.page b/plugin-root/usr/local/emhttp/plugins/u-navigator/U-Navigator.page index f3f270c..d58350a 100644 --- a/plugin-root/usr/local/emhttp/plugins/u-navigator/U-Navigator.page +++ b/plugin-root/usr/local/emhttp/plugins/u-navigator/U-Navigator.page @@ -9,9 +9,12 @@ Tag="Navigator U-Navigator Unraid File Navigator files explorer" Display Settings): black/gray are dark, white/azure light. +$unavUnraidTheme = (string)($display['theme'] ?? ''); +$unavTheme = in_array($unavUnraidTheme, ['black', 'gray'], true) ? 'dark' : (in_array($unavUnraidTheme, ['white', 'azure'], true) ? 'light' : ''); ?> -
+
data-unraid-theme="">

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.