Brand colours and logos for integrations and DNS providers

Kind tags (Integrations, Servers, DNS) are in the brand's colour with its logo
(Simple Icons, CC0), kept readable on both themes; the dashboard cards, the
kind picker and the menu show the logos too, with a per-browser switch for the
menu icons. Settings -> Display -> Badge colours shows the brand defaults and
Use the brand's goes back to them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-10 20:14:20 +01:00
1 parent 9937ab2202
commit d69962528e
18 files changed
+546 -49

No files matched your search

+2
View File
@@ -950,6 +950,8 @@ switched by `?view=`, so a section can be linked to: an alert about a failing se
**The status strip.** Under a server's name, on every section of its page, a row of figures says how it is at a glance: **Status** (online, with when it last reported — or *offline*, with when it did, and a note when Proxmox says the guest is still running, so a stopped agent is not read as a dead machine; for a server with no agent report, what Proxmox says, or that nothing has reported), **Maintenance** (only while a window on this server is on, with when it ends and why), **Alerts** (how many are open about this server and how bad — what a maintenance window, a snooze or a closing has put aside is not counted, but said — and a link to the Alerts page), **Updates** (what is waiting, how many of them security fixes, whether a reboot is needed), **Disk** (the fullest, against its own limit: green, yellow within ten points of it, red at it; a mount with its own limit is judged by that, and an ignored mount is left out), **CPU · memory** and **how long it has run** (for a guest Proxmox reads, or from an agent of version 8 on Linux, 7 on Windows, which say it in every report; left out while the server is offline, since it is then no longer how long it has been up). A figure nothing is known for is left out or says so — it is never filled in. It uses what the page already has plus the alerts and the maintenance windows, read again whenever the page is (the *Refresh* button). Everyone signed in sees it.
**Brand colours and logos.** Every kind of integration and DNS provider has its brand's colour and, where the open icon set [Simple Icons](https://simpleicons.org) (CC0) has one, its logo — Proxmox, Synology, Tailscale, Gitea, Jellyfin, Immich, Nextcloud, Grafana, Prometheus, Home Assistant, Sonarr, Radarr, qBittorrent, Hetzner, Cloudflare, Pi-hole and more. The kind **tags** on the Integrations page (cards and table), the Servers page and the DNS page are in that colour with the logo, made readable on the light and the dark theme alike (the lightness is held where the text reads, the hue kept; every tag is at least 4.9:1 on dark and 5.2:1 on light); the dashboard's integration cards have the logo beside their title; the kind picker has it on each choice; and **the menu** has a small icon before each page in its groups — the logo for an integration's page, the page's own icon for the rest — which **Settings → Display → Menu → Show an icon before each page** switches off for this browser. A few kinds have no open logo (NetBox, Prowlarr, Lidarr, Readarr, SABnzbd, Technitium, osTicket, phpIPAM, Fragnet, Dockhand, Semaphore, UPS): they keep their generic icon and an approximate colour. **Settings → Display → Badge colours** shows each tag as it looks now, lets you choose another colour for any of them, and **Use the brand's** goes back. Logos and names belong to their owners and are used only to tell the systems apart.
**Shorter page introductions.** The few lines under a page’s title that say what the page is are folded to two lines when they are longer than that, with **Show more** under them, so the page’s own content starts higher up. What you choose is remembered for that page in this browser; a short one is shown as it is, a link inside the folded part opens it when you tab to it, and a printout shows all of it.
**Notification history.** Records → Notifications lists every notification that was sent, with how it went through each channel (or why it was not sent: held for quiet hours, a routing rule said nobody, no channel switched on), the error a channel gave when it refused, a filter and a search, and **Send again**. Kept 30 days. See NOTIFICATIONS.md.
+21 -1
View File
@@ -4206,6 +4206,25 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"license": "ISC"
},
"node_modules/simple-icons": {
"version": "16.37.0",
"resolved": "https://registry.npmjs.org/simple-icons/-/simple-icons-16.37.0.tgz",
"integrity": "sha512-8mCJIhpMYOL9g13GW59EiL3sVXJnTEKGCTZFaekl9UQ3Qo0SwVjnLaJ82QiaH8BKBdouEDzrHMXIWh8cBIy48A==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/simple-icons"
},
{
"type": "github",
"url": "https://github.com/sponsors/simple-icons"
}
],
"license": "CC0-1.0",
"engines": {
"node": ">=0.12.18"
}
},
"node_modules/socket.io": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.4.tgz",
@@ -5183,7 +5202,8 @@
"qrcode-generator": "^2.0.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.1.1"
"react-router-dom": "^7.1.1",
"simple-icons": "^16.37.0"
},
"devDependencies": {
"@types/react": "^18.3.18",
+157
View File
@@ -0,0 +1,157 @@
/**
* Brand colours and logos for the kinds of integration and DNS providers: every kind has a colour that is a real colour, the logos that exist are paths that can be drawn, a card's label says which kind
* it is about, going back to a brand's colour is saved in a way the settings can keep, and the menu and the tags use them.
*
* Run with: npm test --workspace server
*/
import { test, describe, before, after } from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import type { AddressInfo } from "node:net";
import type { Server } from "node:http";
const dir = mkdtempSync(join(tmpdir(), "hm-brands-"));
process.env.DATABASE_PATH = join(dir, "test.sqlite");
process.env.SESSION_DIR = join(dir, "sessions");
process.env.CREDENTIALS_ENCRYPTION_KEY = "ab".repeat(32);
const express = (await import("express")).default;
const { db } = await import("../src/db/client.js");
const { users } = await import("../src/db/schema.js");
const { runMigrations } = await import("../src/db/migrate.js");
const { settingsRouter } = await import("../src/routes/settings.js");
const b = await import("../../web/src/utils/brands.js");
const { TYPE_LABELS, TYPE_PAGES } = await import("../../web/src/utils/integrationTypes.js");
await runMigrations();
const web = (...parts: string[]) => readFileSync(join(import.meta.dirname, "..", "..", "web", "src", ...parts), "utf8");
const PROVIDERS = ["cloudflare", "loopia", "pihole", "azure", "cpanel", "technitium"];
describe("the table", () => {
test("every kind of integration has a colour, and a logo is a path that can be drawn", () => {
for (const kind of Object.keys(TYPE_LABELS)) {
const brand = (b.KIND_BRANDS as Record<string, { color: string; path: string | null }>)[kind];
assert.ok(brand, `${kind} has no brand`);
assert.match(brand.color, /^#[0-9a-f]{6}$/, kind);
if (brand.path !== null) assert.match(brand.path, /^M[\d.\- ,a-zA-Z]+$/, `${kind}'s logo is not a path`);
}
assert.equal(Object.keys(b.KIND_BRANDS).length, Object.keys(TYPE_LABELS).length, "no brand for a kind that does not exist");
});
test("every DNS provider has one too", () => {
for (const p of PROVIDERS) assert.match((b.PROVIDER_BRANDS as Record<string, { color: string }>)[p].color, /^#[0-9a-f]{6}$/, p);
assert.equal(Object.keys(b.PROVIDER_BRANDS).length, PROVIDERS.length);
});
test("the well-known ones have their logo, and the few the open set lacks keep their generic icon", () => {
for (const k of ["proxmox", "synology", "tailscale", "gitea", "jellyfin", "immich", "nextcloud", "grafana", "prometheus", "homeassistant", "sonarr", "radarr", "qbittorrent", "hetzner", "cloudflare", "pihole"]) assert.ok(b.brandOf(k)?.path, `${k} has a logo`);
for (const k of ["netbox", "prowlarr", "lidarr", "readarr", "sabnzbd", "technitium", "osticket", "phpipam", "fragnet", "dockhand", "semaphore", "ups", "azure", "loopia"]) assert.equal(b.brandOf(k)?.path, null, `${k} has none`);
});
test("a kind that shares a brand shares its colour (Hetzner Cloud and Robot, Proxmox and its Backup Server)", () => {
assert.equal(b.brandOf("hetzner")?.color, b.brandOf("hetznerrobot")?.color);
assert.equal(b.brandOf("proxmox")?.color, b.brandOf("pbs")?.color);
assert.equal(b.PROVIDER_BRANDS.technitium.color, b.KIND_BRANDS.technitium.color);
});
test("something that is no kind has no brand", () => {
assert.equal(b.brandOf("martian"), null);
assert.equal(b.brandOf(""), null);
});
});
describe("what the page's helpers say", () => {
test("a card's label says which kind it is about, with or without the name of the one integration", () => {
assert.equal(b.kindOfLabel("Jellyfin"), "jellyfin");
assert.equal(b.kindOfLabel("Jellyfin: Media"), "jellyfin");
assert.equal(b.kindOfLabel("Hetzner Cloud: Projekt 1"), "hetzner");
assert.equal(b.kindOfLabel("Technitium DNS"), "technitium");
assert.equal(b.kindOfLabel("Servers down"), null);
assert.equal(b.kindOfLabel(""), null);
});
test("a colour is #rrggbb and nothing else — an empty one is 'none chosen'", () => {
for (const ok of ["#00a4dc", "#FFFFFF"]) assert.equal(b.isHexColor(ok), true, ok);
for (const bad of ["", "00a4dc", "#abc", "#12345g", "red", null, undefined, 5]) assert.equal(b.isHexColor(bad), false, String(bad));
});
});
describe("going back to a brand's colour is kept", () => {
let app: Server;
let base = "";
before(async () => {
await db.insert(users).values({ oidcSub: "admin", name: "Ada", role: "admin" });
const a = express();
a.use(express.json());
a.use((req, _res, next) => {
(req as unknown as { session: unknown }).session = { user: { sub: "admin" } };
next();
});
a.use("/api/settings", settingsRouter);
app = await new Promise<Server>((resolve) => {
const s = a.listen(0, "127.0.0.1", () => resolve(s));
});
base = `http://127.0.0.1:${(app.address() as AddressInfo).port}/api/settings`;
});
after(() => {
app.close();
try {
rmSync(dir, { recursive: true, force: true });
} catch {
// Windows keeps the database file locked until the process exits.
}
});
const put = (body: unknown) => fetch(base, { method: "PUT", headers: { "content-type": "application/json" }, body: JSON.stringify(body) });
const colors = async () => ((await (await fetch(`${base}/integration-colors`)).json()) as { integrationColors: Record<string, string> }).integrationColors;
test("a colour is chosen, and given up by saving an empty one (the settings merge key by key, so a key cannot be taken away)", async () => {
assert.equal((await put({ integrationColors: { proxmox: "#112233", jellyfin: "#445566" } })).status, 200);
assert.deepEqual(await colors(), { proxmox: "#112233", jellyfin: "#445566" });
assert.equal((await put({ integrationColors: { proxmox: "" } })).status, 200);
const now = await colors();
assert.equal(b.isHexColor(now.proxmox), false, "an empty one is none chosen, so the brand's is used");
assert.equal(now.jellyfin, "#445566", "the others are as they were");
});
});
describe("where they are used", () => {
test("the Integrations page, the Servers page and the DNS page draw their tags with the brand tag, and no page is left with the old plain style", () => {
for (const f of ["Integrations.tsx", "Servers.tsx", "Dns.tsx"]) {
const s = web("pages", f);
assert.match(s, /<BrandTag /, f);
assert.ok(!/function (typeBadgeStyle|providerBadgeStyle)/.test(s), `${f} still has its own badge style`);
}
});
test("the menu puts a logo on a page about one kind of integration that has one, and leaves the rest as they were", () => {
const nav = web("layout", "nav.tsx");
assert.match(nav, /export const NAV: NavEntry\[\] = withLogos\(PLAIN_NAV\)/);
assert.match(nav, /kinds\?\.length === 1 && hasLogo\(kinds\[0\]\)/);
// a page of several kinds (Media managers, Download clients) stays generic
assert.ok((nav.match(/PAGE_KINDS\[/g) ?? []).length >= 1);
assert.equal((TYPE_PAGES as Record<string, string>).sonarr, (TYPE_PAGES as Record<string, string>).radarr, "they share a page, so it has no single logo");
});
test("the menu's groups show an icon before each page, switched off per browser by an attribute on the page, and the dashboard cards and kind picker carry the logos", () => {
assert.match(web("layout", "SidebarNav.tsx"), /className="menu-item-icon"[\s\S]*?\{leaf\.icon\}/);
const css = web("styles.css");
assert.match(css, /html\[data-menu-icons="off"\] \.dropdown-item \.menu-item-icon\s*\{\s*display:\s*none/);
assert.match(web("main.tsx"), /applyStoredMenuIcons\(\)/);
assert.match(web("utils", "menuIcons.ts"), /data-menu-icons/);
assert.match(web("pages", "Dashboard.tsx"), /kindOfLabel\(label\)/);
assert.match(web("components", "IntegrationTypePicker.tsx"), /<BrandIcon kind=\{t\}/);
});
test("the tags are readable on both themes: the colour is mixed toward black on the light one and toward white on the dark one", () => {
const css = web("styles.css");
assert.match(css, /\.badge\.brand-tag\s*\{[\s\S]*?color-mix\(in srgb, var\(--b\) \d+%, black\)/);
assert.match(css, /\[data-bs-theme="dark"\] \.badge\.brand-tag\s*\{[\s\S]*?color-mix\(in srgb, var\(--b\) \d+%, white\)/);
assert.match(css, /\.brand-fg\s*\{[\s\S]*?black\)/);
// and where the browser can hold the lightness, it does: no darker than 0.48 on the light theme, no lighter than 0.76 on the dark one
assert.match(css, /@supports \(color: oklch\(from red l c h\)\)[\s\S]*?min\(l, 0\.48\)[\s\S]*?max\(l, 0\.76\)/);
});
});
+2 -1
View File
@@ -16,7 +16,8 @@
"qrcode-generator": "^2.0.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.1.1"
"react-router-dom": "^7.1.1",
"simple-icons": "^16.37.0"
},
"devDependencies": {
"@types/react": "^18.3.18",
+90
View File
@@ -0,0 +1,90 @@
import type { CSSProperties, ReactNode } from "react";
import {
IconBatteryCharging,
IconBinaryTree,
IconBrandDocker,
IconCloud,
IconCloudDownload,
IconDeviceGamepad2,
IconDeviceTv,
IconNetwork,
IconPlayerPlay,
IconPlugConnected,
IconTicket,
IconWorld,
IconWorldWww,
} from "@tabler/icons-react";
import { brandOf, isHexColor } from "../utils/brands";
import { TYPE_LABELS } from "../utils/integrationTypes";
/** For a brand the icon set does not have: the generic icon the menu already used for it. */
const FALLBACK: Record<string, typeof IconCloud> = {
semaphore: IconPlayerPlay,
dockhand: IconBrandDocker,
phpipam: IconNetwork,
osticket: IconTicket,
ups: IconBatteryCharging,
netbox: IconBinaryTree,
fragnet: IconDeviceGamepad2,
prowlarr: IconDeviceTv,
lidarr: IconDeviceTv,
readarr: IconDeviceTv,
technitium: IconWorldWww,
sabnzbd: IconCloudDownload,
azure: IconCloud,
loopia: IconWorld,
};
/** Whether there is a real logo for it (as against the generic icon). */
export const hasLogo = (kind: string): boolean => !!brandOf(kind)?.path;
/**
* The logo of a kind of integration or DNS provider, or its generic icon when there is no logo. In the brand's colour — made readable on the light or the dark theme by the style sheet (.brand-fg) —
* unless `mono`, where it takes the colour of the text around it (the menu), or `color` says one (a colour somebody chose).
*/
export default function BrandIcon({ kind, size = 16, mono = false, color, title }: { kind: string; size?: number; mono?: boolean; color?: string | null; title?: string }) {
const brand = brandOf(kind);
const chosen = isHexColor(color) ? color : null;
const tint: { className?: string; style?: CSSProperties } = mono ? {} : chosen ? { style: { color: chosen } } : brand ? { className: "brand-fg", style: { "--b": brand.color } as CSSProperties } : {};
if (brand?.path) {
return (
<svg {...tint} className={`brand-icon ${tint.className ?? ""}`.trim()} viewBox="0 0 24 24" width={size} height={size} fill="currentColor" role={title ? "img" : undefined} aria-label={title} aria-hidden={title ? undefined : true} focusable="false">
<path d={brand.path} />
</svg>
);
}
const Generic = FALLBACK[kind] ?? IconPlugConnected;
return (
<span {...tint} className={`brand-icon d-inline-flex ${tint.className ?? ""}`.trim()} role={title ? "img" : undefined} aria-label={title} aria-hidden={title ? undefined : true}>
<Generic size={size} />
</span>
);
}
/**
* A tag for a kind of integration or provider: its logo and its name, in its brand colour — or in the colour somebody chose in Settings → Display → Badges, which is used as it is. A kind with no
* brand at all is a plain grey tag.
*/
export function BrandTag({ kind, label, custom, className = "", children }: { kind: string; label?: string; custom?: string | null; className?: string; children?: ReactNode }) {
const text = label ?? (TYPE_LABELS as Record<string, string>)[kind] ?? kind;
const brand = brandOf(kind);
const chosen = isHexColor(custom) ? custom : null;
if (chosen) {
return (
<span className={`badge d-inline-flex align-items-center gap-1 ${className}`.trim()} style={{ backgroundColor: `${chosen}22`, color: chosen, border: `1px solid ${chosen}55` }}>
<BrandIcon kind={kind} size={13} color={chosen} />
{text}
{children}
</span>
);
}
if (!brand) return <span className={`badge bg-secondary-lt ${className}`.trim()}>{text}{children}</span>;
return (
<span className={`badge brand-tag ${className}`.trim()} style={{ "--b": brand.color } as CSSProperties}>
<BrandIcon kind={kind} size={13} mono />
{text}
{children}
</span>
);
}
+3 -1
View File
@@ -1,6 +1,7 @@
import { useState } from "react";
import type { IntegrationType } from "../api/client";
import { groupTypes, TYPE_LABELS } from "../utils/integrationTypes";
import BrandIcon from "./BrandIcon";
/**
* Chooses a kind of integration: the kinds in groups, as the sidebar groups their pages, with a box that narrows them by name or group ("net" finds NetBox and the Network group's).
@@ -36,7 +37,8 @@ export default function IntegrationTypePicker({ available, value, onChange }: {
<div className="text-secondary small text-uppercase fw-bold mb-1">{g.label}</div>
<div className="btn-list">
{g.types.map((t) => (
<button key={t} type="button" role="radio" aria-checked={t === value} className={`btn btn-sm ${t === value ? "btn-primary" : ""}`} onClick={() => onChange(t)}>
<button key={t} type="button" role="radio" aria-checked={t === value} className={`btn btn-sm d-inline-flex align-items-center gap-1 ${t === value ? "btn-primary" : ""}`} onClick={() => onChange(t)}>
<BrandIcon kind={t} size={14} mono={t === value} />
{TYPE_LABELS[t]}
</button>
))}
+3
View File
@@ -133,6 +133,9 @@ export default function SidebarNav({
const subRow = (leaf: NavLeaf) => (
<div className="nav-row" key={leaf.to}>
<NavLink to={leaf.to} className={({ isActive }) => `dropdown-item d-flex align-items-center ${isActive ? "active" : ""}`} onClick={onNavigate}>
<span className="menu-item-icon" aria-hidden="true">
{leaf.icon}
</span>
{leaf.label}
{badgeOf(leaf.to)}
</NavLink>
+17 -2
View File
@@ -65,7 +65,8 @@ import {
IconReportAnalytics,
} from "@tabler/icons-react";
import type { CurrentUser } from "../api/client";
import { isPageHidden } from "../utils/navVisibility";
import { isPageHidden, PAGE_KINDS, pagePath } from "../utils/navVisibility";
import BrandIcon, { hasLogo } from "../components/BrandIcon";
// The menu: what pages there are, how they are grouped, and which role is needed to see each. Used by the sidebar, the command
// palette, the keyboard shortcuts and the breadcrumbs, so they always agree.
@@ -91,7 +92,7 @@ export type NavEntry = NavLeaf | NavGroup;
export const isGroup = (entry: NavEntry): entry is NavGroup => "items" in entry;
export const NAV: NavEntry[] = [
const PLAIN_NAV: NavEntry[] = [
{ to: "/", label: "Dashboard", icon: <IconLayoutDashboard size={20} /> },
{ to: "/alerts", label: "Alerts", icon: <IconAlertTriangle size={20} /> },
{ to: "/my-work", label: "My work", icon: <IconChecklist size={20} />, minRole: "operator" },
@@ -223,6 +224,20 @@ export const NAV: NavEntry[] = [
},
];
/**
* The menu, with the logo of an integration where a page is about one kind of integration and the icon set has its logo (Proxmox, Jellyfin, Grafana …) in place of the generic icon. The logo takes
* the colour of the menu's text, like every other icon in it, so it does not turn the menu into a row of colours; the brand colours are in the tags on the Integrations page.
*/
function withLogos(entries: NavEntry[]): NavEntry[] {
const logo = (leaf: NavLeaf): NavLeaf => {
const kinds = PAGE_KINDS[pagePath(leaf.to)];
return kinds?.length === 1 && hasLogo(kinds[0]) ? { ...leaf, icon: <BrandIcon kind={kinds[0]} size={20} mono /> } : leaf;
};
return entries.map((e) => (isGroup(e) ? { ...e, items: e.items.map(logo) } : logo(e)));
}
export const NAV: NavEntry[] = withLogos(PLAIN_NAV);
const roleRank: Record<CurrentUser["role"], number> = { viewer: 0, operator: 1, admin: 2 };
/** What this role can see: pages it isn't allowed are dropped, so are pages of integrations nobody has added when the Display setting says to leave those out, an emptied group disappears, and a group down to one page becomes that page's own link. */
+2
View File
@@ -6,10 +6,12 @@ import "@tabler/core/dist/css/tabler.min.css";
import "./styles.css";
import { loadEnvironment } from "./utils/environment";
import { applyStoredDensity } from "./utils/density";
import { applyStoredMenuIcons } from "./utils/menuIcons";
// Dev and production can be told apart (ENVIRONMENT_NAME / ENVIRONMENT_COLOR on the server); do it before anything is drawn.
void loadEnvironment();
applyStoredDensity();
applyStoredMenuIcons();
// Production only — in dev the worker would just add another layer between Vite and the browser.
if ("serviceWorker" in navigator && import.meta.env.PROD) {
+7 -1
View File
@@ -29,6 +29,8 @@ import { ErrorNotice } from "../components/Notice";
import { WidgetSkeleton } from "../components/Skeleton";
import { TYPE_GROUPS, TYPE_LABELS, TYPE_PAGES } from "../utils/integrationTypes";
import type { Agenda, Heartbeat } from "../api/client";
import BrandIcon from "../components/BrandIcon";
import { kindOfLabel } from "../utils/brands";
const DNS_TYPE_COLORS: Record<string, string> = {
A: "#60a5fa",
@@ -211,6 +213,7 @@ function WidgetCard({ label, badge, hide, children }: { label: string; badge?: R
// rest follow the order they chose — a card nobody has placed goes last, in the order it was drawn.
const hidden = layout.hidden.includes(label);
const problem = problemOf(badge);
const kind = kindOfLabel(label);
if (hidden && !editing) return null;
return (
<div className="col-md-6" data-card={label} style={{ order: (layout.order[label] ?? UNPLACED) - (problemsFirst && !editing ? (problem === "bad" ? 2_000_000 : problem === "warn" ? 1_000_000 : 0) : 0) }}>
@@ -232,7 +235,10 @@ function WidgetCard({ label, badge, hide, children }: { label: string; badge?: R
)}
<div className="card-body">
<div className="d-flex align-items-center mb-2">
<div className="subheader">{label}</div>
<div className="subheader d-flex align-items-center gap-1">
{kind && <BrandIcon kind={kind} size={14} />}
{label}
</div>
{badge && <div className="ms-auto">{badge}</div>}
</div>
{children}
+2 -9
View File
@@ -26,6 +26,7 @@ import { ErrorNotice } from "../components/Notice";
import { toast } from "../utils/toast";
import { readableError } from "../utils/errors";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import { BrandTag } from "../components/BrandIcon";
const PROVIDER_LABELS: Record<DnsProviderType, string> = {
cloudflare: "Cloudflare",
@@ -38,12 +39,6 @@ const PROVIDER_LABELS: Record<DnsProviderType, string> = {
const emptyRecordForm: DnsRecordInput = { type: "A", name: "", content: "", ttl: 3600, priority: undefined, proxied: undefined };
function providerBadgeStyle(colors: Record<string, string>, providerType: DnsProviderType): CSSProperties {
const color = colors[providerType];
if (!color) return {};
return { backgroundColor: `${color}22`, color, border: `1px solid ${color}55` };
}
const dnsTabs = (view: "records" | "domains") => (
<ViewTabs
label="DNS view"
@@ -405,9 +400,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
<tr key={p.id}>
<td>{p.name}</td>
<td>
<span className="badge" style={providerBadgeStyle(providerColors, p.providerType)}>
{PROVIDER_LABELS[p.providerType]}
</span>
<BrandTag kind={p.providerType} label={PROVIDER_LABELS[p.providerType]} custom={providerColors[p.providerType]} />
</td>
<td>
<button
+3 -12
View File
@@ -21,6 +21,7 @@ import { hostOf, integrationRow, integrationStatus, type IntegrationRow } from "
import { useSortable } from "../hooks/useSortable";
import SortableTh from "../components/SortableTh";
import PageIntro from "../components/PageIntro";
import { BrandTag } from "../components/BrandIcon";
function HealthBadge({ i }: { i: IntegrationSummary }) {
const status = integrationStatus(i);
@@ -54,12 +55,6 @@ function rememberLayout(layout: "cards" | "table") {
}
}
function typeBadgeStyle(colors: Record<string, string>, type: IntegrationType): CSSProperties {
const color = colors[type];
if (!color) return {};
return { backgroundColor: `${color}22`, color, border: `1px solid ${color}55` };
}
const integrationTabs = (view: "list" | "calls") => (
<ViewTabs
label="Integrations view"
@@ -347,9 +342,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
<tr key={i.id}>
<td className="fw-bold text-nowrap">{i.name}</td>
<td>
<span className="badge" style={typeBadgeStyle(integrationColors, i.type)}>
{TYPE_LABELS[i.type]}
</span>
<BrandTag kind={i.type} custom={integrationColors[i.type]} />
</td>
<td className="text-secondary">{groupOfType(i.type).label}</td>
<td className="text-secondary">{hostOf(i.baseUrl) || "no web address"}</td>
@@ -389,9 +382,7 @@ function IntegrationsList({ user, tabs }: { user: CurrentUser; tabs: ReactNode }
<div className="fw-bold text-truncate">{i.name}</div>
<div className="text-secondary small text-truncate">{hostOf(i.baseUrl) || "no web address"}</div>
</div>
<span className="badge flex-shrink-0" style={typeBadgeStyle(integrationColors, i.type)}>
{TYPE_LABELS[i.type]}
</span>
<BrandTag kind={i.type} custom={integrationColors[i.type]} className="flex-shrink-0" />
</div>
<div className="mb-3">
<HealthBadge i={i} />
+2 -9
View File
@@ -26,12 +26,7 @@ import EmptyState, { EmptyRow, LoadingRow } from "../components/EmptyState";
import BulkBar from "../components/BulkBar";
import { RunsOnBulkDrawer, SilenceBulkDrawer, TagBulkDrawer } from "../components/BulkDrawers";
import { doBulk, plural } from "../utils/bulk";
function typeBadgeStyle(colors: Record<string, string>, type: string): CSSProperties {
const color = colors[type];
if (!color) return {};
return { backgroundColor: `${color}22`, color, border: `1px solid ${color}55` };
}
import { BrandTag } from "../components/BrandIcon";
export default function Servers({ user }: { user: CurrentUser }) {
@@ -235,9 +230,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
<div className="text-secondary small">{s.hostname ?? "no hostname reported"}</div>
</div>
{s.proxmoxIntegrationId ? (
<span className="badge" style={typeBadgeStyle(integrationColors, "proxmox")}>
Proxmox
</span>
<BrandTag kind="proxmox" custom={integrationColors.proxmox} />
) : s.lastSeenAt ? (
agentState(s, agentLatest) === "behind" ? (
<span className="badge bg-yellow-lt text-yellow" title="Its agent is older than the one this Homelab Manager would install now. Run its install command again to update it.">
+24 -13
View File
@@ -3,6 +3,8 @@ import { TYPE_LABELS } from "../../utils/integrationTypes";
import { api } from "../../api/client";
import { ErrorNotice } from "../../components/Notice";
import { PageSkeleton } from "../../components/Skeleton";
import { BrandTag } from "../../components/BrandIcon";
import { brandOf, isHexColor } from "../../utils/brands";
const PROVIDER_NAMES: Record<string, string> = {
cloudflare: "Cloudflare",
@@ -13,31 +15,38 @@ const PROVIDER_NAMES: Record<string, string> = {
technitium: "Technitium",
};
/**
* One row for each kind: its tag as it looks now (its brand colour and logo, or the colour chosen here), a colour to choose instead, and — once one is chosen — a way back to the brand's.
* "Back to the brand's" is saved as an empty colour: the settings are merged key by key, so a key cannot be taken away, only given nothing.
*/
function ColorList({
names,
colors,
onChange,
onReset,
}: {
names: Record<string, string>;
colors: Record<string, string>;
onChange: (id: string, color: string) => void;
onReset: (id: string) => void;
}) {
return (
<div className="d-flex flex-column gap-2">
{Object.entries(names).map(([id, name]) => {
const color = colors[id] ?? "#6366f1";
const custom = isHexColor(colors[id]) ? colors[id] : null;
const color = custom ?? brandOf(id)?.color ?? "#6366f1";
return (
<div key={id} className="d-flex align-items-center gap-2">
<span className="badge" style={{ backgroundColor: `${color}22`, color, border: `1px solid ${color}55`, minWidth: 110 }}>
{name}
<div key={id} className="d-flex align-items-center gap-2 flex-wrap">
<span style={{ minWidth: 170 }}>
<BrandTag kind={id} label={name} custom={custom} />
</span>
<input
type="color"
value={color}
className="form-control form-control-color"
onChange={(e) => onChange(id, e.target.value)}
/>
<span className="text-secondary small">{color}</span>
<input type="color" value={color} className="form-control form-control-color" aria-label={`Colour for ${name}`} onChange={(e) => onChange(id, e.target.value)} />
<span className="text-secondary small">{custom ? color : brandOf(id) ? `${color} — the brand's` : color}</span>
{custom && brandOf(id) && (
<button type="button" className="btn btn-sm btn-link p-0" onClick={() => onReset(id)}>
Use the brand&rsquo;s
</button>
)}
</div>
);
})}
@@ -105,11 +114,12 @@ export default function BadgeSettings() {
<h3 className="card-title">DNS provider badge colors</h3>
</div>
<div className="card-body">
<p className="text-secondary">Customize the color of each DNS provider's badge throughout the app.</p>
<p className="text-secondary">Each provider's badge is in its brand's colour, with its logo where there is one. Choose another colour for any of them to use that throughout the app instead.</p>
<ColorList
names={PROVIDER_NAMES}
colors={providerColors}
onChange={(id, color) => setProviderColors((c) => ({ ...c, [id]: color }))}
onReset={(id) => setProviderColors((c) => ({ ...c, [id]: "" }))}
/>
</div>
</div>
@@ -121,11 +131,12 @@ export default function BadgeSettings() {
<h3 className="card-title">Integration badge colors</h3>
</div>
<div className="card-body">
<p className="text-secondary">Customize the color of each integration type's badge throughout the app.</p>
<p className="text-secondary">Each kind's badge is in its brand's colour, with its logo where there is one (a few have an approximate colour: the brand has no open logo). Choose another colour for any of them to use that throughout the app instead.</p>
<ColorList
names={TYPE_LABELS}
colors={integrationColors}
onChange={(id, color) => setIntegrationColors((c) => ({ ...c, [id]: color }))}
onReset={(id) => setIntegrationColors((c) => ({ ...c, [id]: "" }))}
/>
</div>
</div>
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
import { api, type AppSettings, type DateFormat, type TimeFormat } from "../../api/client";
import { setDateTimeSettings } from "../../utils/date";
import { setPageSize } from "../../utils/pageSize";
import { getMenuIcons, setMenuIcons } from "../../utils/menuIcons";
import { MENU_CHANGED } from "../../hooks/useMenuHiding";
import { PAGE_KINDS, unusedPages } from "../../utils/navVisibility";
import { NAV, isGroup } from "../../layout/nav";
@@ -25,6 +26,8 @@ export default function DisplaySettings() {
const [timeFormat, setTimeFormatState] = useState<TimeFormat>("24h");
const [pageSize, setPageSizeState] = useState(20);
const [hideUnusedPages, setHideUnusedPages] = useState(false);
// Per browser, not saved with the other settings: it takes effect at once.
const [menuIcons, setMenuIconsState] = useState(getMenuIcons());
// The kinds of integration that have been added, to say which pages the setting would leave out.
const [added, setAdded] = useState<string[] | null>(null);
const [saving, setSaving] = useState(false);
@@ -159,6 +162,19 @@ export default function DisplaySettings() {
<h3 className="card-title">Menu</h3>
</div>
<div className="card-body">
<label className="form-check mb-2">
<input
type="checkbox"
className="form-check-input"
checked={menuIcons}
onChange={(e) => {
setMenuIcons(e.target.checked);
setMenuIconsState(e.target.checked);
}}
/>
<span className="form-check-label">Show an icon before each page in the menu</span>
<span className="form-hint d-block">The logo of the system for an integration&rsquo;s page, the page&rsquo;s own icon for the rest. Only for this browser, and it applies at once.</span>
</label>
<label className="form-check">
<input type="checkbox" className="form-check-input" checked={hideUnusedPages} onChange={(e) => setHideUnusedPages(e.target.checked)} />
<span className="form-check-label">Hide the pages of integrations I have not added</span>
+59
View File
@@ -2090,3 +2090,62 @@ tr.alert-row-child > td:first-child {
display: none;
}
}
/* ── Brand colours: a tag, and a logo, in a brand's colour (--b), mixed toward black on the light theme and toward white on the dark one so it reads on either (components/BrandIcon.tsx). ── */
.brand-fg {
color: color-mix(in srgb, var(--b) 62%, black);
}
[data-bs-theme="dark"] .brand-fg {
color: color-mix(in srgb, var(--b) 58%, white);
}
.badge.brand-tag {
display: inline-flex;
align-items: center;
gap: 0.3em;
color: color-mix(in srgb, var(--b) 62%, black);
background-color: color-mix(in srgb, var(--b) 14%, transparent);
border: 1px solid color-mix(in srgb, var(--b) 38%, transparent);
}
[data-bs-theme="dark"] .badge.brand-tag {
color: color-mix(in srgb, var(--b) 58%, white);
}
/* Where the browser can change one part of a colour: keep the brand's hue and strength but hold its lightness where it reads — dark enough on the light theme, light enough on the dark one. */
@supports (color: oklch(from red l c h)) {
.brand-fg,
.badge.brand-tag {
color: oklch(from var(--b) min(l, 0.48) c h);
}
[data-bs-theme="dark"] .brand-fg,
[data-bs-theme="dark"] .badge.brand-tag {
color: oklch(from var(--b) max(l, 0.76) c h);
}
}
.brand-icon {
flex-shrink: 0;
vertical-align: -0.15em;
}
/* ── A small icon before each page in the menu's groups (the logo of an integration's system where there is one); Settings → Display can switch it off for this browser. ── */
.dropdown-item .menu-item-icon {
display: inline-flex;
flex-shrink: 0;
width: 1.1rem;
height: 1.1rem;
margin-right: 0.6rem;
opacity: 0.85;
}
.dropdown-item .menu-item-icon > svg {
width: 100%;
height: 100%;
}
html[data-menu-icons="off"] .dropdown-item .menu-item-icon {
display: none;
}
+104
View File
@@ -0,0 +1,104 @@
import {
siAdguard,
siAuthentik,
siCloudflare,
siCpanel,
siGitea,
siGrafana,
siHetzner,
siHomeassistant,
siImmich,
siJellyfin,
siN8n,
siNextcloud,
siNginxproxymanager,
siPaperlessngx,
siPihole,
siPrometheus,
siProxmox,
siQbittorrent,
siRadarr,
siSonarr,
siSpeedtest,
siSynology,
siTailscale,
siUbiquiti,
siUptimekuma,
} from "simple-icons";
import type { DnsProviderType, IntegrationType } from "../api/client";
import { TYPE_LABELS } from "./integrationTypes";
/**
* What each kind of integration and each DNS provider looks like: its brand colour, and its logo as an SVG path (24 × 24) where the open icon set Simple Icons (CC0) has one. The logos and
* names belong to their owners and are used here only to tell which system is which. A brand the set does not have has no path — it keeps the generic icon it had — and a colour that is an
* approximation of its look (marked below), not an official one.
*/
export interface Brand {
/** "#rrggbb". */
color: string;
/** The logo, as the path of a 24 × 24 SVG; null when there is none. */
path: string | null;
}
const of = (icon: { hex: string; path: string }): Brand => ({ color: `#${icon.hex.toLowerCase()}`, path: icon.path });
const plain = (color: string): Brand => ({ color, path: null });
export const KIND_BRANDS: Record<IntegrationType, Brand> = {
proxmox: of(siProxmox),
pbs: of(siProxmox),
synology: of(siSynology),
tailscale: of(siTailscale),
gitea: of(siGitea),
uptimekuma: of(siUptimekuma),
unifi: of(siUbiquiti),
npm: of(siNginxproxymanager),
homeassistant: of(siHomeassistant),
jellyfin: of(siJellyfin),
authentik: of(siAuthentik),
prometheus: of(siPrometheus),
immich: of(siImmich),
paperless: of(siPaperlessngx),
nextcloud: of(siNextcloud),
n8n: of(siN8n),
hetzner: of(siHetzner),
hetznerrobot: of(siHetzner),
speedtest: of(siSpeedtest),
sonarr: of(siSonarr),
radarr: of(siRadarr),
adguard: of(siAdguard),
grafana: of(siGrafana),
qbittorrent: of(siQbittorrent),
// Not in the icon set: the colour is close to how the product looks, not official.
semaphore: plain("#33cc99"),
dockhand: plain("#2496ed"),
phpipam: plain("#2f70b7"),
osticket: plain("#3e7cb1"),
ups: plain("#f59f00"),
netbox: plain("#1b7dbf"),
fragnet: plain("#e8423f"),
prowlarr: plain("#e66000"),
technitium: plain("#2b6cb0"),
lidarr: plain("#00a65b"),
readarr: plain("#8e2121"),
sabnzbd: plain("#f5c242"),
};
export const PROVIDER_BRANDS: Record<DnsProviderType, Brand> = {
cloudflare: of(siCloudflare),
pihole: of(siPihole),
cpanel: of(siCpanel),
technitium: KIND_BRANDS.technitium,
azure: plain("#0078d4"),
loopia: plain("#1e73be"),
};
export const brandOf = (type: string): Brand | null => (KIND_BRANDS as Record<string, Brand>)[type] ?? (PROVIDER_BRANDS as Record<string, Brand>)[type] ?? null;
/** The kind a card is about, from its label: "Jellyfin", or "Jellyfin: Media" for one named integration; null for a card about anything else. */
export function kindOfLabel(label: string): IntegrationType | null {
const head = label.split(":")[0].trim();
return (Object.keys(TYPE_LABELS) as IntegrationType[]).find((t) => TYPE_LABELS[t] === head) ?? null;
}
/** Whether a string is a colour as the settings keep one: "#rrggbb". */
export const isHexColor = (v: unknown): v is string => typeof v === "string" && /^#[0-9a-fA-F]{6}$/.test(v);
+32
View File
@@ -0,0 +1,32 @@
// Whether each page in the menu's groups has a small icon before its name (the logo of the system for an integration's page, the page's own icon for the rest). On unless switched off.
// Chosen per browser, like the density: the styles key off the data-menu-icons attribute on <html>.
const KEY = "hlm-menu-icons";
export function getMenuIcons(): boolean {
return document.documentElement.getAttribute("data-menu-icons") !== "off";
}
function apply(on: boolean): void {
if (on) document.documentElement.removeAttribute("data-menu-icons");
else document.documentElement.setAttribute("data-menu-icons", "off");
}
/** Called once at start-up, before anything is drawn, so the menu never flashes in the wrong way. */
export function applyStoredMenuIcons(): void {
try {
if (localStorage.getItem(KEY) === "off") apply(false);
} catch {
// storage blocked: the icons are shown
}
}
export function setMenuIcons(on: boolean): void {
apply(on);
try {
if (on) localStorage.removeItem(KEY);
else localStorage.setItem(KEY, "off");
} catch {
// not remembered; it still applies for this visit
}
}