Add dashboard UI source and track it in the repository.

Expose the Vite/React website source under dashboard/ (with node_modules still ignored) so the full dashboard can be built and maintained from this repo.
This commit is contained in:
Char committed 2026-07-26 13:09:19 +01:00
1 parent e97e281bda
commit b82f69783d
117 files changed
+18615 -3

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
/** Normalize user/config colour strings to #rrggbb (lowercase). */
export function normalizeHex(value: string, fallback = "#000000"): string {
let s = String(value ?? "").trim();
if (!s) return fallback;
if (!s.startsWith("#")) s = `#${s}`;
const hex = s.slice(1);
if (/^[0-9a-fA-F]{3}$/.test(hex)) {
return `#${hex
.split("")
.map((c) => c + c)
.join("")
.toLowerCase()}`;
}
if (/^[0-9a-fA-F]{6}$/.test(hex)) {
return `#${hex.toLowerCase()}`;
}
return fallback;
}
export function isValidHex(value: string): boolean {
const s = String(value ?? "").trim();
return /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(s) || /^[0-9a-fA-F]{6}$/.test(s);
}