Grey by default A page where everything is coloured has no way to say "look here". Colour is spent, not applied, and this is the budget: the chrome is grey and the only saturated thing on screen is the thing that needs a person. npm i lucide-react Tokens this needs: --card, --foreground, --muted, --muted-foreground, --border, --status-warn, --status-critical The status, chart, scale, state and direction names are an extension, not a rename. shadcn has --destructive and five --chart-* and nothing else in this territory. ──────────────────────────────────────────────────────────────────────── // QuietWall.tsx ──────────────────────────────────────────────────────────────────────── import { cn } from "@/lib/utils"; import { STATUS_META, type Status } from "../semantic-status-color/status"; /** * A monitoring wall that is grey until something is wrong. * * Chrome, labels and every healthy series are neutral. Colour is spent only * on a panel whose status is not nominal, and saturation carries severity: * warn is muted, critical is full strength and thicker. A coloured panel also * gets a border and the status glyph, so the state survives a projector and * a colourblind viewer, and colour is never the only thing saying it. * * Which status a panel holds is the caller's decision. The thresholds live * with whoever owns the rule, not in the drawing. */ export type Panel = { key: string; values: number[]; status: Status }; type Props = { panels: Panel[]; unit: string; columns?: number; onOpen?: (panel: Panel) => void; }; const STROKE: Record = { nominal: "stroke-muted-foreground", warn: "stroke-status-warn opacity-60", critical: "stroke-status-critical", unknown: "stroke-muted-foreground opacity-40", }; const FRAME: Record = { nominal: "border-border", warn: "border-status-warn/50", critical: "border-status-critical", unknown: "border-dashed border-border", }; const W = 84, H = 40; export function QuietWall({ panels, unit, columns = 3, onOpen }: Props) { // One scale for the wall, so a climb is a climb. const all = panels.flatMap((p) => p.values); const lo = Math.min(...all), hi = Math.max(...all), span = hi - lo || 1; const n = panels[0]?.values.length ?? 1; const x = (i: number) => 6 + (i / (n - 1)) * (W - 12); const y = (v: number) => H - 4 - ((v - lo) / span) * (H - 8); return (
{panels.map((panel) => { const { label, Icon } = STATUS_META[panel.status]; const loud = panel.status !== "nominal"; const last = panel.values[panel.values.length - 1]; const d = panel.values.map((v, i) => `${i ? "L" : "M"}${x(i).toFixed(1)} ${y(v).toFixed(1)}`).join(" "); return ( ); })}
); } ──────────────────────────────────────────────────────────────────────── // demo.tsx ──────────────────────────────────────────────────────────────────────── import { QuietWall, type Panel } from "./QuietWall"; /** * Six services, errors per minute. Four are healthy and grey. payments has * crossed the warn threshold and is coloured but muted. checkout is critical * and is the only saturated thing on the screen. The statuses arrive from the * alert rules; the wall only draws them. */ const PANELS: Panel[] = [ { key: "edge", values: [16, 22, 14, 28, 22], status: "nominal" }, { key: "api", values: [20, 26, 18, 30, 24], status: "nominal" }, { key: "auth", values: [22, 16, 24, 18, 26], status: "nominal" }, { key: "queue", values: [16, 24, 18, 26, 20], status: "nominal" }, { key: "payments", values: [18, 22, 28, 34, 38], status: "warn" }, { key: "checkout", values: [14, 18, 32, 44, 48], status: "critical" }, ]; export default function Demo() { return (
prod eu-west 15m
{ location.hash = `#service-${p.key}`; }} />
); }