summaryrefslogtreecommitdiff
path: root/web/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app.js')
-rw-r--r--web/app.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/web/app.js b/web/app.js
index d26d051..1e10ad3 100644
--- a/web/app.js
+++ b/web/app.js
@@ -3097,6 +3097,23 @@ function switchTab(name) {
poll();
}
+// ── Version color ─────────────────────────────────────────────────────────────
+
+async function applyVersionColor() {
+ try {
+ const res = await fetch(`${BASE_PATH}/api/version`);
+ if (!res.ok) return;
+ const { version } = await res.json();
+ // Use first 6 hex chars of version as hue seed (works for commit hashes and "dev")
+ const hex = version.replace(/[^0-9a-f]/gi, '').slice(0, 6).padEnd(6, '0');
+ const hue = Math.round((parseInt(hex, 16) / 0xffffff) * 360);
+ const h1 = document.querySelector('header h1');
+ if (h1) h1.style.color = `hsl(${hue}, 70%, 55%)`;
+ } catch {
+ // non-fatal — logo stays default color
+ }
+}
+
// ── Boot ──────────────────────────────────────────────────────────────────────
if (typeof document !== 'undefined') {
@@ -3105,6 +3122,7 @@ if (typeof document !== 'undefined') {
handleStartNextTask(this);
});
+ applyVersionColor();
switchTab(getActiveMainTab());
startPolling();
connectWebSocket();