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 -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
}
}