Expand description
Per-agent color assignment — palette, deterministic pick, validation.
Agents carry a display color in the per-agent content store
(agent_content, content_type = "ui:color", value #rrggbb). It is
assigned at creation (createagent handler), backfilled for existing
agents by migration m0020_agent_color_backfill, and seeded into each
new agent block’s frame:bordercolor meta at agent.open so the
existing pane-frame rendering displays it with no frontend changes.
See docs/specs/SPEC_AGENT_COLOR_2026_08_08.md.
Constants§
- AGENT_
COLOR_ PALETTE - The 14-hue palette — hex values mirror the frontend’s
AGENT_COLOR_PALETTE(frontend/app/view/agent/agent-color.ts). Duplicated deliberately: assigned colors are STORED, not derived, so palette drift between the two lists cannot recolor existing agents. This is a distinct, deliberately-vivid array from the frontend’s tab strip colors (frontend/app/tab/tab.tsx’sTAB_COLORS) — see docs/specs/SPEC_TAB_COLOR_DESATURATION_2026_08_13.md.
Functions§
- dim_
agent_ color - Dimmed variant for the UNFOCUSED pane border (
frame:bordercolor), keeping the full-strength color for the focused border (frame:activebordercolor) — the agent’s color stays visible either way, and focus stays distinguishable by brightness. Input must already have passedis_valid_agent_color; returns the input unchanged if it somehow hasn’t. - is_
valid_ agent_ color - Strict
#rrggbbshape check — the stored value flows into block meta that the frontend applies as a CSS border-color, so a corrupt or hand-edited row must not be able to inject arbitrary CSS. - pick_
agent_ color - Pick a palette color for an agent — deterministic FNV-1a hash of the
agent id mapped onto the palette. Effectively random across agents,
stable across re-runs and machines, and dependency-free (no
rand).