Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

refactor(colours): semantic colour tokens, one table per meaning

iceclatterWT149968818062
diff --git a/CLAUDE.md b/CLAUDE.md
index 5ff5961f6..6ec868a06 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -3667,6 +3667,34 @@ colour. MEASURED against the live hook server before the change; both faces are
iOS follow-up (@eneskirca), not a desktop one.
+## Semantic colours (one role per meaning)
+
+Status and accent colours are TOKENS in `styles.css`, never hues at a call site. Two layers:
+the Apple system palette `--sys-red … --sys-gray` (dark values in `:root`, light values in the light
+block) and the ROLES that rules actually name — `--state-working | attention | unread | error |
+success | warning | queued | automation` and `--git-modified | added | deleted | renamed |
+conflict`. A role is a FILL value (glow, dot, stroke, and chip washes via
+`color-mix(in srgb, var(--state-x) N%, transparent)`); text in a status hue keeps the text-safe
+tokens `--danger --warn --caution --success --agent-working`, which the light theme darkens.
+
+- **An appearance re-maps a MEANING by redefining a role**, not by restyling rules. The default look
+ keeps its historical hues (working clay, unread = accent, attention red, warning orange); Liquid
+ Glass maps them to the HIG semantics (see its section).
+- **JS that needs a literal** (xterm find decorations, canvas-drawn sprites, the notch HUD, which does
+ not load styles.css) reads `renderer/lib/palette.ts`; `styles.palette.test.ts` pins `--sys-*` to
+ that table. JS that styles the DOM passes `'var(--role)'` strings (the minimap strokes, the git
+ status letters, kanban priorities). Hex-with-alpha suffixes (`${c}2e`) do not work on a var —
+ use `color-mix`.
+- **Git status colours have ONE table**, `renderer/lib/gitStatusColors.ts`, used by Source Control
+ and the history commit list; an unknown status draws in `--text`.
+- **The minimap strokes read the same roles as the node glows**; they used to be crossed (working
+ yellow, unread clay). The palette test pins canvas glow = minimap stroke = minimap halo per state.
+- **Left as-is on purpose:** agent brand colours (`AGENT_CONFIG`) on Claude-identity surfaces (the
+ subagent node, the usage pill icon, the mascot), the node colour swatches (`node-colors.ts` is an
+ allowlist — stored project colours must stay valid), node-kind default colours (persisted into
+ project files at creation), kanban label chips (own palette), presence colours, the onboarding
+ scenes, the notch HUD's own stylesheet.
+
## Node icons (emoji or picture)
A node may carry `data.icon` (`NodeIcon` in `@shared/node-icon`): `{type:'emoji', value}` or
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 71333f74c..b18dde0fd 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -976,19 +976,15 @@ function StatusAwareMiniMap({ onNodeDoubleClick }: { onNodeDoubleClick: (node: N
},
[onNodeDoubleClick]
)
- // Status language matches the canvas glows/badges: amber = working, red = needs you,
- // clay = unread. The classes below add the minimap-scale glow/pulse (styles.css).
- //
- // Unread is CLAY (#d97757) — the agent-hook colour the RUNNING badge and the node's working glow
- // already use — and not the accent blue it used to be: blue is also the fallback stroke for a
- // node that carries no colour of its own, so "finished while you were away" was painted the
- // exact shade as "nothing to report" and vanished into the map.
+ // Status strokes read the SAME role tokens as the node glows (styles.css --state-*), so the map
+ // and the canvas cannot disagree; the classes below add the minimap-scale glow/pulse. Unread
+ // also pulses a thicker stroke, which keeps it apart from an uncoloured node's accent stroke.
const nodeStrokeColor = useCallback(
(n: Node): string => {
const st = statusById[n.id]
- if (st?.state === 'working') return '#ffd60a'
- if (st?.state === 'waiting' || st?.state === 'blocked') return '#ff453a'
- if (st?.unread) return '#d97757'
+ if (st?.state === 'working') return 'var(--state-working)'
+ if (st?.state === 'waiting' || st?.state === 'blocked') return 'var(--state-attention)'
+ if (st?.unread) return 'var(--state-unread)'
return (n.data as { color?: string })?.color ?? '#0a84ff'
},
[statusById]
@@ -14684,7 +14680,9 @@ export function Canvas() {
padding: '6px 12px',
fontSize: 12,
color: 'var(--text)',
- background: isError ? 'rgba(120,40,40,0.92)' : 'rgba(90,72,30,0.92)',
+ background: isError
+ ? 'color-mix(in srgb, var(--state-error) 36%, var(--surface-overlay))'
+ : 'color-mix(in srgb, var(--state-warning) 22%, var(--surface-overlay))',
border: '1px solid var(--border)',
borderRadius: 8
}}
@@ -14695,7 +14693,7 @@ export function Canvas() {
width: 8,
height: 8,
borderRadius: '50%',
- background: '#ff6b6b'
+ background: 'var(--state-error)'
}}
/>
) : (
diff --git a/src/renderer/components/SourceControlPanel.tsx b/src/renderer/components/SourceControlPanel.tsx
index 9c67cf8c4..4efb040ce 100644
--- a/src/renderer/components/SourceControlPanel.tsx
+++ b/src/renderer/components/SourceControlPanel.tsx
@@ -21,6 +21,7 @@ import { defaultScmScope, type ScmScope } from '@shared/scm-scope'
import { chipFor, effectiveBindings } from '../lib/keybindingOverrides'
import { matchesShortcut } from '@shared/shortcut'
import { isMacPlatform } from '@shared/platform-utils'
+import { gitStatusColor } from '../lib/gitStatusColors'
export interface SourceControlPanelProps {
onClose: () => void
@@ -44,14 +45,6 @@ const AUTO_FETCH_MS = 180_000
/** Which physical modifier the registry's abstract `Cmd` resolves to for the commit chord. */
const isMac = isMacPlatform()
-const STATUS_COLOR: Record<string, string> = {
- M: '#ffd60a',
- A: '#32d74b',
- D: '#ff453a',
- R: '#bf5af2',
- U: '#6ac4dc'
-}
-
function DiffStat({ added, deleted }: { added: number; deleted: number }) {
if (!added && !deleted) return null
return (
@@ -294,7 +287,7 @@ export function SourceControlPanel({
setFileMenu({ x: e.clientX, y: e.clientY, path: f.path })
}}
>
- <span className="scm-letter" style={{ color: STATUS_COLOR[f.status] ?? 'rgba(255,255,255,0.85)' }}>
+ <span className="scm-letter" style={{ color: gitStatusColor(f.status) }}>
{f.status}
</span>
<button
diff --git a/src/renderer/components/SshProjectDialog.tsx b/src/renderer/components/SshProjectDialog.tsx
index fc6568b02..3c6c5b030 100644
--- a/src/renderer/components/SshProjectDialog.tsx
+++ b/src/renderer/components/SshProjectDialog.tsx
@@ -391,7 +391,7 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
</div>
)}
{mkdirErr && (
- <p className="confirm__msg" style={{ color: 'var(--danger, #e5534b)', margin: '0 0 8px', fontSize: 12 }}>
+ <p className="confirm__msg" style={{ color: 'var(--danger)', margin: '0 0 8px', fontSize: 12 }}>
{mkdirErr}
</p>
)}
diff --git a/src/renderer/components/git-history/GitHistoryCommitFiles.tsx b/src/renderer/components/git-history/GitHistoryCommitFiles.tsx
index 30644a095..011f4c304 100644
--- a/src/renderer/components/git-history/GitHistoryCommitFiles.tsx
+++ b/src/renderer/components/git-history/GitHistoryCommitFiles.tsx
@@ -1,9 +1,7 @@
import type { GitFileChange } from '@shared/types'
import { formatGitHistoryTimestamp } from './git-history-format'
+import { gitStatusColor } from '../../lib/gitStatusColors'
-const STATUS_COLOR: Record<string, string> = {
- M: '#ffd60a', A: '#32d74b', D: '#ff453a', R: '#bf5af2', U: '#6ac4dc'
-}
export type GitHistoryCommitFilesState =
| { status: 'loading' }
@@ -26,7 +24,7 @@ export function GitHistoryCommitFiles({
<div className="scm-history__files">
{meta && <div className="scm-history__meta">{meta}</div>}
{state.status === 'loading' && <div className="scm-history__meta">Loading files…</div>}
- {state.status === 'error' && <div className="scm-history__meta" style={{ color: '#ff453a' }} title={state.error}>{state.error}</div>}
+ {state.status === 'error' && <div className="scm-history__meta" style={{ color: 'var(--danger)' }} title={state.error}>{state.error}</div>}
{state.status === 'ready' && state.entries.length === 0 && (
<div className="scm-history__meta">No file changes in this commit</div>
)}
@@ -36,7 +34,7 @@ export function GitHistoryCommitFiles({
const dir = entry.path.includes('/') ? entry.path.slice(0, entry.path.lastIndexOf('/')) : ''
return (
<button key={entry.path} type="button" className="scm-history__file" title={entry.path} onClick={() => onOpenFile(entry)}>
- <span style={{ width: 12, textAlign: 'center', fontWeight: 700, fontSize: 10, color: STATUS_COLOR[entry.status] ?? 'rgba(255,255,255,0.85)' }}>
+ <span style={{ width: 12, textAlign: 'center', fontWeight: 700, fontSize: 10, color: gitStatusColor(entry.status) }}>
{entry.status}
</span>
<span style={{ minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
diff --git a/src/renderer/components/git-history/GitHistoryPanel.tsx b/src/renderer/components/git-history/GitHistoryPanel.tsx
index 24d25d12f..8c801554a 100644
--- a/src/renderer/components/git-history/GitHistoryPanel.tsx
+++ b/src/renderer/components/git-history/GitHistoryPanel.tsx
@@ -83,7 +83,7 @@ export function GitHistoryPanel({
</button>
<button title="Refresh commits" onClick={onRefresh}>{loading ? '…' : '⟳'}</button>
</div>
- {!collapsed && error && !result && <div className="scm-history__msg" style={{ color: '#ff453a' }}>{error}</div>}
+ {!collapsed && error && !result && <div className="scm-history__msg" style={{ color: 'var(--danger)' }}>{error}</div>}
{!collapsed && !result && !error && <div className="scm-history__msg">Loading graph…</div>}
{!collapsed && result && viewModels.length === 0 && <div className="scm-history__msg">No commits yet</div>}
{!collapsed && viewModels.length > 0 && (
diff --git a/src/renderer/components/kanban/CardMetaBar.tsx b/src/renderer/components/kanban/CardMetaBar.tsx
index a05521041..d5f2890d7 100644
--- a/src/renderer/components/kanban/CardMetaBar.tsx
+++ b/src/renderer/components/kanban/CardMetaBar.tsx
@@ -12,10 +12,10 @@ import { useProjects } from '../../state/projects'
const initialOf = (name: string): string => (name.trim()[0] ?? '?').toUpperCase()
export const PRIORITIES: Array<{ id: KanbanPriority; label: string; color: string }> = [
- { id: 'low', label: 'Low', color: '#8e8e93' },
- { id: 'medium', label: 'Medium', color: '#ffd60a' },
- { id: 'high', label: 'High', color: '#ff9f0a' },
- { id: 'urgent', label: 'Urgent', color: '#ff453a' }
+ { id: 'low', label: 'Low', color: 'var(--state-queued)' },
+ { id: 'medium', label: 'Medium', color: 'var(--caution)' },
+ { id: 'high', label: 'High', color: 'var(--warn)' },
+ { id: 'urgent', label: 'Urgent', color: 'var(--danger)' }
]
/** Local-wallclock value for a datetime-local input (its value is timezone-less). */
@@ -156,7 +156,7 @@ export function CardMetaBar({ nodeId, board, onChange }: CardMetaBarProps) {
<button
key={pr.id}
className={`kanban-prio${priority === pr.id ? ' kanban-prio--on' : ''}`}
- style={priority === pr.id ? { background: `${pr.color}2e`, borderColor: pr.color, color: pr.color } : undefined}
+ style={priority === pr.id ? { background: `color-mix(in srgb, ${pr.color} 18%, transparent)`, borderColor: pr.color, color: pr.color } : undefined}
title={priority === pr.id ? `${pr.label} — click to clear` : pr.label}
onClick={() => onChange(setCardPriority(board, nodeId, priority === pr.id ? null : pr.id))}
>
diff --git a/src/renderer/components/kanban/ModalTerminal.tsx b/src/renderer/components/kanban/ModalTerminal.tsx
index 1356b70e3..c9bdc3bf1 100644
--- a/src/renderer/components/kanban/ModalTerminal.tsx
+++ b/src/renderer/components/kanban/ModalTerminal.tsx
@@ -1,4 +1,5 @@
import { useContextEnsure } from '../../terminal/useContextEnsure'
+import { FIND_DECORATIONS } from '../../lib/palette'
import { ptyRefusal } from '@shared/pty-refusal'
import { patchImeModeSwitch } from '../../terminal/ime-mode-switch'
@@ -154,12 +155,7 @@ export function ModalTerminal({ nodeId, spawn, searchOpen, onCloseSearch }: Moda
})
// MIRROR TerminalNode's findOpts — one source for the highlight colors.
const findOpts = {
- decorations: {
- matchBackground: '#ffd54f55',
- activeMatchBackground: '#ffb300',
- matchOverviewRuler: '#ffd54f',
- activeMatchColorOverviewRuler: '#ffb300'
- }
+ decorations: FIND_DECORATIONS
}
const handleNext = useCallback(() => {
search.next()
diff --git a/src/renderer/components/kanban/SessionCard.tsx b/src/renderer/components/kanban/SessionCard.tsx
index c5580503c..f31e167ac 100644
--- a/src/renderer/components/kanban/SessionCard.tsx
+++ b/src/renderer/components/kanban/SessionCard.tsx
@@ -6,14 +6,10 @@ import { ContextMeter } from '../ContextMeter'
import { isRemoteSessionNode } from '@shared/worktree'
import { NodeIconView } from '../NodeIcon'
import { LabelChips } from './LabelChips'
+import { PRIORITIES } from './CardMetaBar'
import type { KanbanSession } from './KanbanView'
-const PRIO_COLOR: Record<KanbanPriority, string> = {
- low: '#8e8e93',
- medium: '#ffd60a',
- high: '#ff9f0a',
- urgent: '#ff453a'
-}
+const PRIO_COLOR = Object.fromEntries(PRIORITIES.map((p) => [p.id, p.color])) as Record<KanbanPriority, string>
interface SessionCardProps {
session: KanbanSession
@@ -161,7 +157,7 @@ export const SessionCard = memo(function SessionCard({
{priority !== undefined && PRIO_COLOR[priority] && (
<span
className="kanban-due kanban-prio-chip"
- style={{ background: `${PRIO_COLOR[priority]}26`, color: PRIO_COLOR[priority] }}
+ style={{ background: `color-mix(in srgb, ${PRIO_COLOR[priority]} 15%, transparent)`, color: PRIO_COLOR[priority] }}
>
{priority.toUpperCase()}
</span>
diff --git a/src/renderer/components/settings/sections/AccountsSection.tsx b/src/renderer/components/settings/sections/AccountsSection.tsx
index 5f7e8d782..12f711668 100644
--- a/src/renderer/components/settings/sections/AccountsSection.tsx
+++ b/src/renderer/components/settings/sections/AccountsSection.tsx
@@ -98,7 +98,7 @@ function MachinePanel({
<div className="flex flex-wrap items-center gap-2">
<span
className={`inline-block h-2 w-2 rounded-full ${
- !remote || connected ? 'bg-[color:var(--ok,#30d158)]' : 'bg-[color:var(--muted-2)]'
+ !remote || connected ? 'bg-[color:var(--state-success)]' : 'bg-[color:var(--muted-2)]'
}`}
aria-hidden
title={!remote ? 'This machine' : connected ? 'Connected' : 'Not connected'}
diff --git a/src/renderer/components/settings/sections/LicenseSection.tsx b/src/renderer/components/settings/sections/LicenseSection.tsx
index 9ce14b1be..d45bcfbef 100644
--- a/src/renderer/components/settings/sections/LicenseSection.tsx
+++ b/src/renderer/components/settings/sections/LicenseSection.tsx
@@ -184,7 +184,7 @@ export function LicenseSection({
{releasing ? 'Releasing…' : 'Release other devices'}
</Button>
{releaseNote ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
{releaseNote}
</p>
) : null}
@@ -241,7 +241,7 @@ export function LicenseSection({
exactly who this screen exists for, and `Could not activate (seat_limit).` is
a dead end: the word is unsearchable and names no way out. */}
{ent.status.error ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
{activationErrorSentence(ent.status.error)}
</p>
) : null}
diff --git a/src/renderer/components/settings/sections/PhoneSection.tsx b/src/renderer/components/settings/sections/PhoneSection.tsx
index d7eda3987..9f9d4480f 100644
--- a/src/renderer/components/settings/sections/PhoneSection.tsx
+++ b/src/renderer/components/settings/sections/PhoneSection.tsx
@@ -216,7 +216,7 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
{phase === 'timeout' ? (
<p
className={ended?.reason === 'relay-failed' ? 'text-sm' : 'text-sm text-muted'}
- style={ended?.reason === 'relay-failed' ? { color: '#ff9f0a' } : undefined}
+ style={ended?.reason === 'relay-failed' ? { color: 'var(--warn)' } : undefined}
>
{pairingEndedMessage({ ...ended, windows: !sshKey })}
</p>
@@ -232,7 +232,7 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
{gate === 'relay-off' || gate === 'relay-dev' ? (
// Relay-only host (Windows): no key is installed, so the relay IS the connection
// and a code without it would pair the phone to nothing.
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
{relayGateMessage(gate, 'Remote access from your phone')}
</p>
) : gate === 'ssh-off' ? (
@@ -240,7 +240,7 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
// sshd installs a key the phone can never use — the scan must wait, not the fix.
// The live probe (usePhonePairing) flips sshOpen and the QR appears by itself.
<div className="space-y-2">
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
<strong>{sshServer.name}</strong> is off, so your phone wouldn&apos;t be able
to connect after pairing. Turn it on — the QR appears here the moment it is
(watching, no need to restart pairing).
@@ -291,20 +291,20 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
{!sshKey ? (
<p className="text-xs text-muted">{relayOnlyExplanation(windowsKeyFile)}</p>
) : relayPlan === 'dev' ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
Dev build: the relay is off regardless of the toggle, so this code pairs
LAN-only. Run a packaged build — or set NODETERM_RELAY_URL — for remote
access.
</p>
) : !phoneAccessEnabled ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
LAN-only code: the phone will reach this machine only on this network. Turn
on <strong>Remote access from your phone</strong> above first to also
connect from cellular — the QR refreshes by itself.
</p>
) : null}
{sshHealed ? (
- <p className="text-sm" style={{ color: '#30d158' }}>
+ <p className="text-sm" style={{ color: 'var(--success)' }}>
✓ {sshServer.name} is on — scan away.
</p>
) : null}
@@ -316,17 +316,17 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
{phase === 'paired' ? (
<div className="space-y-3">
- <p className="text-sm font-medium" style={{ color: '#30d158' }}>
+ <p className="text-sm font-medium" style={{ color: 'var(--success)' }}>
{sshKey
? '✓ Paired. Your phone can now connect with its own key.'
: '✓ Paired. Your phone connects to this computer through remote access.'}
</p>
{relayResult === 'ok' ? (
- <p className="text-sm" style={{ color: '#30d158' }}>
+ <p className="text-sm" style={{ color: 'var(--success)' }}>
Remote access is set up — the phone can reach this machine from anywhere.
</p>
) : relayResult === 'failed' ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
⚠ Remote-access setup failed, so this pairing is LAN-only for now. Check this
machine&apos;s internet connection and pair again to retry — or the phone will
pick it up by itself next time it connects on this network.
@@ -347,7 +347,7 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
) : null}
{error ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
{error}
</p>
) : null}
@@ -382,7 +382,7 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
{revokeNote ? (
<p
className={revokeNote.warn ? 'text-sm' : 'text-sm text-muted'}
- style={revokeNote.warn ? { color: '#ff9f0a' } : undefined}
+ style={revokeNote.warn ? { color: 'var(--warn)' } : undefined}
>
{revokeNote.text}
</p>
diff --git a/src/renderer/components/settings/sections/RemoteSection.tsx b/src/renderer/components/settings/sections/RemoteSection.tsx
index bef5edf3e..d1ccc8a8e 100644
--- a/src/renderer/components/settings/sections/RemoteSection.tsx
+++ b/src/renderer/components/settings/sections/RemoteSection.tsx
@@ -175,7 +175,7 @@ export function RemoteSection({
)}
</Button>
{remoteError ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
{remoteError}
</p>
) : null}
diff --git a/src/renderer/components/settings/sections/SpeechSection.tsx b/src/renderer/components/settings/sections/SpeechSection.tsx
index 4e0c52c6d..8c79dee95 100644
--- a/src/renderer/components/settings/sections/SpeechSection.tsx
+++ b/src/renderer/components/settings/sections/SpeechSection.tsx
@@ -319,7 +319,7 @@ export function SpeechSection({
{downloading ? ` · downloading ${pct}%` : ''}
</p>
{rowError[m.id] ? (
- <p className="text-[12px]" style={{ color: '#ff9f0a' }}>
+ <p className="text-[12px]" style={{ color: 'var(--warn)' }}>
{rowError[m.id]}
</p>
) : null}
diff --git a/src/renderer/components/settings/sections/TeamAccessSection.tsx b/src/renderer/components/settings/sections/TeamAccessSection.tsx
index b9664c43e..ec784c5ca 100644
--- a/src/renderer/components/settings/sections/TeamAccessSection.tsx
+++ b/src/renderer/components/settings/sections/TeamAccessSection.tsx
@@ -143,12 +143,12 @@ export function TeamAccessSection({
<p className="text-sm text-muted">All seats in use — add a seat.</p>
) : null}
{atCap ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
All seats in use — add a seat.
</p>
) : null}
{error ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ <p className="text-sm" style={{ color: 'var(--warn)' }}>
{error}
</p>
) : null}
diff --git a/src/renderer/lib/gitStatusColors.ts b/src/renderer/lib/gitStatusColors.ts
new file mode 100644
index 000000000..654474062
--- /dev/null
+++ b/src/renderer/lib/gitStatusColors.ts
@@ -0,0 +1,17 @@
+/**
+ * The ONE git file-status colour table. Both git panels (Source Control and the history commit
+ * list) draw a status letter with it; each value is a role token from styles.css, so an appearance
+ * re-maps it there (Liquid Glass does) and the light theme's text-safe hues apply by construction.
+ * An unknown status (`??`, `C`, `T`…) draws in the plain label colour.
+ */
+const GIT_STATUS_COLORS: Record<string, string> = {
+ M: 'var(--git-modified)',
+ A: 'var(--git-added)',
+ D: 'var(--git-deleted)',
+ R: 'var(--git-renamed)',
+ U: 'var(--git-conflict)'
+}
+
+export function gitStatusColor(status: string): string {
+ return GIT_STATUS_COLORS[status] ?? 'var(--text)'
+}
diff --git a/src/renderer/lib/mascot.ts b/src/renderer/lib/mascot.ts
index 816228d46..cf11a6f76 100644
--- a/src/renderer/lib/mascot.ts
+++ b/src/renderer/lib/mascot.ts
@@ -1,3 +1,5 @@
+import { AGENT_CONFIG } from '@shared/agents/config'
+import { SYSTEM_COLORS } from './palette'
// Walking agent mascots — desktop canvas RUNNING badge (docs/mascot-sprites.md).
//
// The Claude critter is drawn at runtime from a terminal quadrant-block pixel map (no image
@@ -13,8 +15,8 @@
// Codex uses a real spritesheet asset (pet-codex.webp) imported by the component; here we only
// export its frame geometry so the CSS animation and the component agree on the numbers.
-/** Anthropic coral / clay — rgb(217, 120, 87) (= 0.85, 0.47, 0.34). */
-export const CORAL = 'rgb(217, 120, 87)'
+/** Anthropic coral / clay — the Claude brand colour, from the one agent table. */
+export const CORAL = AGENT_CONFIG.claude.color
/** Sub-pixel grid of one Claude frame: 9 quadrant cols × 2 = 18, 3 rows × 2 = 6. */
export const SUB_COLS = 18
@@ -139,7 +141,7 @@ export const CLAUDE_MASCOT = {
// the Claude sprite above, so the HUD stays plain-DOM with no per-pixel JS.
/** systemGreen — matches agent-notch's NSColor.systemGreen done blob. */
-export const DONE_GREEN = 'rgb(48, 209, 88)'
+export const DONE_GREEN = SYSTEM_COLORS.dark.green
/** 7×7 filled-circle mask (1 = green pixel). */
export const DONE_BLOB_ART: readonly (readonly number[])[] = [
diff --git a/src/renderer/lib/palette.ts b/src/renderer/lib/palette.ts
new file mode 100644
index 000000000..14ff6ba64
--- /dev/null
+++ b/src/renderer/lib/palette.ts
@@ -0,0 +1,61 @@
+/**
+ * The Apple system colours (HIG color.md) for the few JS consumers that need a LITERAL — xterm
+ * search decorations, canvas-drawn sprites, the notch HUD window (which does not load styles.css).
+ * Everything that styles the DOM uses the `--sys-*` / `--state-*` tokens in styles.css instead;
+ * `styles.palette.test.ts` pins those declarations to this table so the two cannot drift.
+ */
+export type SystemColor =
+ | 'red'
+ | 'orange'
+ | 'yellow'
+ | 'green'
+ | 'mint'
+ | 'teal'
+ | 'cyan'
+ | 'blue'
+ | 'indigo'
+ | 'purple'
+ | 'pink'
+ | 'brown'
+ | 'gray'
+
+export const SYSTEM_COLORS: Record<'dark' | 'light', Record<SystemColor, string>> = {
+ dark: {
+ red: '#ff453a',
+ orange: '#ff9f0a',
+ yellow: '#ffd60a',
+ green: '#30d158',
+ mint: '#63e6e2',
+ teal: '#40cbe0',
+ cyan: '#64d2ff',
+ blue: '#0a84ff',
+ indigo: '#5e5ce6',
+ purple: '#bf5af2',
+ pink: '#ff375f',
+ brown: '#ac8e68',
+ gray: '#98989d'
+ },
+ light: {
+ red: '#ff3b30',
+ orange: '#ff9500',
+ yellow: '#ffcc00',
+ green: '#34c759',
+ mint: '#00c7be',
+ teal: '#30b0c7',
+ cyan: '#32ade6',
+ blue: '#007aff',
+ indigo: '#5856d6',
+ purple: '#af52de',
+ pink: '#ff2d55',
+ brown: '#a2845e',
+ gray: '#8e8e93'
+ }
+}
+
+/** Terminal find highlight (Apple's find highlight is yellow; the current match is brighter). */
+export const FIND_DECORATIONS = {
+ matchBackground: `${SYSTEM_COLORS.dark.yellow}55`,
+ activeMatchBackground: SYSTEM_COLORS.dark.orange,
+ matchOverviewRuler: SYSTEM_COLORS.dark.yellow,
+ activeMatchColorOverviewRuler: SYSTEM_COLORS.dark.orange
+}
diff --git a/src/renderer/lib/usageFormat.ts b/src/renderer/lib/usageFormat.ts
index f14da3c10..0f9df7260 100644
--- a/src/renderer/lib/usageFormat.ts
+++ b/src/renderer/lib/usageFormat.ts
@@ -1,3 +1,4 @@
+import { SYSTEM_COLORS } from './palette'
// Pure formatting helpers for the usage indicator.
/** "just now" / "5m ago" / "2h ago". */
@@ -44,6 +45,9 @@ export function formatModelLabel(model: string | null): string | null {
return version ? `${family} ${version}` : family
}
+// Literals, not tokens: the notch HUD draws these too and does not load styles.css.
+const { red: RED, yellow: YELLOW, green: GREEN } = SYSTEM_COLORS.dark
+
/**
* Fill color for a CONTEXT-WINDOW meter: green while low, yellow from 60% used, red past 85%.
* Keyed to USED percent — the inverse scale of `barColor`/`severityColor`, which are keyed to
@@ -52,16 +56,16 @@ export function formatModelLabel(model: string | null): string | null {
* used to carry its own copy of these numbers (issue #78).
*/
export function contextFillColor(usedPercent: number): string {
- if (usedPercent > 85) return '#ff453a'
- if (usedPercent >= 60) return '#ffd60a'
- return '#30d158'
+ if (usedPercent > 85) return RED
+ if (usedPercent >= 60) return YELLOW
+ return GREEN
}
/** Bar color by remaining quota: green > 40%, yellow 20–40%, red < 20%. */
export function barColor(leftPercent: number): string {
- if (leftPercent > 40) return '#30d158'
- if (leftPercent >= 20) return '#ffd60a'
- return '#ff453a'
+ if (leftPercent > 40) return GREEN
+ if (leftPercent >= 20) return YELLOW
+ return RED
}
/**
@@ -73,12 +77,12 @@ export function barColor(leftPercent: number): string {
export function severityColor(severity: string | null, leftPercent: number): string {
switch (severity) {
case 'normal':
- return '#30d158'
+ return GREEN
case 'warning':
- return '#ffd60a'
+ return YELLOW
case 'critical':
case 'exceeded':
- return '#ff453a'
+ return RED
default:
return barColor(leftPercent)
}
diff --git a/src/renderer/nodes/LoopNode.tsx b/src/renderer/nodes/LoopNode.tsx
index a6f5dcfc6..b61a149e8 100644
--- a/src/renderer/nodes/LoopNode.tsx
+++ b/src/renderer/nodes/LoopNode.tsx
@@ -55,7 +55,7 @@ export function LoopNode({ id, data, selected }: NodeProps<CanvasNode>) {
return (
<div onPointerDownCapture={select} className={`loop-node${active ? ' working' : ''}`}>
- <NodeResizer isVisible={selected} minWidth={NODE_MIN_SIZES.loop.width} minHeight={NODE_MIN_SIZES.loop.height} color="#bf7af0" />
+ <NodeResizer isVisible={selected} minWidth={NODE_MIN_SIZES.loop.width} minHeight={NODE_MIN_SIZES.loop.height} color="var(--state-automation)" />
<Handle type="target" position={Position.Top} isConnectable={false} />
<div className="loop-node__head nodrag" onClick={toggle} style={{ cursor: 'pointer' }}>
<button
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsx
index 9b69d6588..f75658d1e 100644
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@ -1,4 +1,5 @@
import { useContextEnsure } from '../terminal/useContextEnsure'
+import { FIND_DECORATIONS } from '../lib/palette'
import { ptyRefusal } from '@shared/pty-refusal'
import { patchImeModeSwitch } from '../terminal/ime-mode-switch'
@@ -2025,12 +2026,7 @@ export function TerminalNode({
// Single source of truth for the on-screen highlight colors (used by both the
// initial-highlight effect and the prev/next nav handlers below).
const findOpts = {
- decorations: {
- matchBackground: '#ffd54f55',
- activeMatchBackground: '#ffb300',
- matchOverviewRuler: '#ffd54f',
- activeMatchColorOverviewRuler: '#ffb300'
- }
+ decorations: FIND_DECORATIONS
}
// Navigation steps the hook's authoritative cursor AND xterm's on-screen highlight.
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 978648373..a1f589427 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -46,7 +46,44 @@
--danger: #ff453a;
--warn: #ff9f0a;
--caution: #ffd60a;
- --success: #32d74b;
+ --success: #30d158;
+
+ /* The Apple system colours (HIG color.md), dark values; the light block restates them with the
+ light values. `lib/palette.ts` holds the same table for the JS that needs a literal (xterm
+ search decorations) and `styles.palette.test.ts` pins the two together. */
+ --sys-red: #ff453a;
+ --sys-orange: #ff9f0a;
+ --sys-yellow: #ffd60a;
+ --sys-green: #30d158;
+ --sys-mint: #63e6e2;
+ --sys-teal: #40cbe0;
+ --sys-cyan: #64d2ff;
+ --sys-blue: #0a84ff;
+ --sys-indigo: #5e5ce6;
+ --sys-purple: #bf5af2;
+ --sys-pink: #ff375f;
+ --sys-brown: #ac8e68;
+ --sys-gray: #98989d;
+
+ /* Semantic roles: ONE colour per meaning. Rules name a role, never a hue, so an appearance
+ re-maps a meaning in one place (Liquid Glass does, at the end of the sheet). These are the
+ FILL values — glows, dots, strokes, chip washes via color-mix. Text in a status hue uses the
+ text-safe tokens above (--danger, --warn, --caution, --success, --agent-working), which the
+ light theme darkens for a pale field. */
+ --state-working: #d97757; /* the default look keeps the working clay */
+ --state-attention: var(--sys-red); /* needs you */
+ --state-unread: var(--accent); /* finished, not yet seen */
+ --state-error: var(--sys-red); /* error, deny, destructive, failed */
+ --state-success: var(--sys-green); /* done, approve, passed, added */
+ --state-warning: var(--sys-orange); /* non-blocking warning, caution */
+ --state-queued: var(--sys-gray); /* queued, idle, disarmed */
+ --state-automation: var(--sys-purple); /* loop / schedule / trigger status */
+ /* Git file status, read by `lib/gitStatusColors.ts` (the ONE table both git panels draw). */
+ --git-modified: var(--caution);
+ --git-added: var(--success);
+ --git-deleted: var(--danger);
+ --git-renamed: var(--sys-purple);
+ --git-conflict: var(--sys-teal);
/* THE CANVAS. Deliberately blacker than `--bg` in dark — the nodes are the content and the
field behind them recedes. In light it has to go the other way, off-white and slightly
@@ -100,13 +137,13 @@
--canvas-dot: #303030;
--minimap-mask: rgba(10, 12, 18, 0.6);
--git-graph-ref: var(--accent);
- --git-graph-remote-ref: #bf5af2;
- --git-graph-base-ref: #ff9f0a;
- --git-graph-lane-1: #32d74b;
- --git-graph-lane-2: #ffd60a;
- --git-graph-lane-3: #6ac4dc;
- --git-graph-lane-4: #ff453a;
- --git-graph-lane-5: #ac8e68;
+ --git-graph-remote-ref: var(--sys-purple);
+ --git-graph-base-ref: var(--sys-orange);
+ --git-graph-lane-1: var(--sys-green);
+ --git-graph-lane-2: var(--sys-yellow);
+ --git-graph-lane-3: var(--sys-teal);
+ --git-graph-lane-4: var(--sys-red);
+ --git-graph-lane-5: var(--sys-brown);
--radius: 8px;
--radius-sm: 6px;
--radius-lg: 12px;
@@ -225,6 +262,23 @@
so "working" still reads as the same colour in both themes. */
--agent-working: #b04a28;
+ /* Apple's light-mode system colours (see the dark block). */
+ --sys-red: #ff3b30;
+ --sys-orange: #ff9500;
+ --sys-yellow: #ffcc00;
+ --sys-green: #34c759;
+ --sys-mint: #00c7be;
+ --sys-teal: #30b0c7;
+ --sys-cyan: #32ade6;
+ --sys-blue: #007aff;
+ --sys-indigo: #5856d6;
+ --sys-purple: #af52de;
+ --sys-pink: #ff2d55;
+ --sys-brown: #a2845e;
+ --sys-gray: #8e8e93;
+ /* The glows always drew the dark clay, in both themes. */
+ --state-working: #d97757;
+
/* Dots must read as a grid, not as noise: the dark-mode grey is far too heavy on a pale field,
and a neutral one would be the only cold thing on screen. */
--canvas-dot: #eae3d6;
@@ -694,7 +748,7 @@ body,
}
.tab-menu button.danger:hover:not(:disabled) {
- background: rgba(247, 118, 142, 0.15);
+ background: color-mix(in srgb, var(--state-error) 15%, transparent);
}
/* "Default Claude account" inline expandable group inside the caret menu. */
@@ -800,7 +854,7 @@ body,
}
.dock-btn.active {
- background: rgba(10, 132, 255, 0.22);
+ background: color-mix(in srgb, var(--accent) 22%, transparent);
color: var(--accent-hover);
}
@@ -1181,8 +1235,8 @@ body,
}
.dictation__mic--active {
- background: rgba(255, 69, 58, 0.18);
- border-color: rgba(255, 69, 58, 0.5);
+ background: color-mix(in srgb, var(--state-error) 18%, transparent);
+ border-color: color-mix(in srgb, var(--state-error) 50%, transparent);
color: var(--danger);
animation: dictation-pulse 1.4s ease-in-out infinite;
animation-play-state: var(--nt-anim-state);
@@ -1196,10 +1250,10 @@ body,
@keyframes dictation-pulse {
0%,
100% {
- box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.4);
+ box-shadow: 0 0 0 0 color-mix(in srgb, var(--state-error) 40%, transparent);
}
50% {
- box-shadow: 0 0 0 6px rgba(255, 69, 58, 0);
+ box-shadow: 0 0 0 6px color-mix(in srgb, var(--state-error) 0%, transparent);
}
}
@@ -1313,15 +1367,15 @@ body,
border-radius: 8px;
font-size: 12px;
color: var(--danger);
- background: rgba(255, 69, 58, 0.12);
- border: 1px solid rgba(255, 69, 58, 0.35);
+ background: color-mix(in srgb, var(--state-error) 12%, transparent);
+ border: 1px solid color-mix(in srgb, var(--state-error) 35%, transparent);
}
.dictation__error-action {
flex-shrink: 0;
background: transparent;
border: none;
- color: #0a84ff;
+ color: var(--accent);
font-size: 12px;
font-weight: 500;
cursor: pointer;
@@ -1514,8 +1568,8 @@ body,
.term-node.unread {
border-color: var(--accent);
box-shadow:
- 0 0 0 1px rgba(10, 132, 255, 0.5),
- 0 0 16px 1px rgba(10, 132, 255, 0.35),
+ 0 0 0 1px color-mix(in srgb, var(--state-unread) 50%, transparent),
+ 0 0 16px 1px color-mix(in srgb, var(--state-unread) 35%, transparent),
0 8px 28px rgba(0, 0, 0, calc(0.4 * var(--shadow-k)));
}
@@ -1527,8 +1581,8 @@ body,
pointer-events: none;
z-index: -1;
box-shadow:
- 0 0 0 1px rgba(10, 132, 255, 0.8),
- 0 0 26px 4px rgba(10, 132, 255, 0.6);
+ 0 0 0 1px color-mix(in srgb, var(--state-unread) 80%, transparent),
+ 0 0 26px 4px color-mix(in srgb, var(--state-unread) 60%, transparent);
opacity: 0;
animation: nt-unread-glow 2s ease-in-out infinite;
will-change: opacity;
@@ -1551,8 +1605,8 @@ body,
is false while working). Shadows only — the top border keeps the node's own color. */
.term-node.working {
box-shadow:
- 0 0 0 1px rgba(217, 119, 87, 0.35),
- 0 0 14px 1px rgba(217, 119, 87, 0.22),
+ 0 0 0 1px color-mix(in srgb, var(--state-working) 35%, transparent),
+ 0 0 14px 1px color-mix(in srgb, var(--state-working) 22%, transparent),
0 8px 28px rgba(0, 0, 0, calc(0.4 * var(--shadow-k)));
}
@@ -1564,8 +1618,8 @@ body,
pointer-events: none;
z-index: -1;
box-shadow:
- 0 0 0 1px rgba(217, 119, 87, 0.45),
- 0 0 22px 3px rgba(217, 119, 87, 0.35);
+ 0 0 0 1px color-mix(in srgb, var(--state-working) 45%, transparent),
+ 0 0 22px 3px color-mix(in srgb, var(--state-working) 35%, transparent);
opacity: 0.25;
animation: nt-working-glow 2.6s ease-in-out infinite;
will-change: opacity;
@@ -1585,8 +1639,8 @@ body,
a touch more insistent than working (deeper pulse, faster cycle): it's asking for you. */
.term-node.attention {
box-shadow:
- 0 0 0 1px rgba(255, 69, 58, 0.4),
- 0 0 14px 1px rgba(255, 69, 58, 0.25),
+ 0 0 0 1px color-mix(in srgb, var(--state-attention) 40%, transparent),
+ 0 0 14px 1px color-mix(in srgb, var(--state-attention) 25%, transparent),
0 8px 28px rgba(0, 0, 0, calc(0.4 * var(--shadow-k)));
}
@@ -1598,8 +1652,8 @@ body,
pointer-events: none;
z-index: -1;
box-shadow:
- 0 0 0 1px rgba(255, 69, 58, 0.55),
- 0 0 22px 3px rgba(255, 69, 58, 0.4);
+ 0 0 0 1px color-mix(in srgb, var(--state-attention) 55%, transparent),
+ 0 0 22px 3px color-mix(in srgb, var(--state-attention) 40%, transparent);
opacity: 0.15;
animation: nt-attention-glow 1.8s ease-in-out infinite;
will-change: opacity;
@@ -1831,14 +1885,14 @@ body,
white-space: nowrap;
font-size: 11px;
color: var(--muted);
- background: rgba(10, 132, 255, 0.14);
+ background: color-mix(in srgb, var(--accent) 14%, transparent);
border-radius: 6px;
}
/* Account folder missing at spawn → session fell back to the system account (orange warning). */
.node-account-chip--warning {
color: var(--warn);
- background: rgba(255, 159, 10, 0.16);
+ background: color-mix(in srgb, var(--state-warning) 16%, transparent);
}
/* Observed-account variants. The base chip is the managed-account look; these keep the three
@@ -1853,7 +1907,7 @@ body,
/* A config dir the user linked: theirs, not one nodeterm minted — a hairline instead of a fill. */
.node-account-chip--linked {
background: transparent;
- box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.35);
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
/* A config dir nodeterm has no record of. Dashed = provisional: the tooltip says to link it in
@@ -1887,7 +1941,7 @@ body,
/* RUNNING matches the working spinner + node glow (clay #d97757), not the base green. */
.term-node__status--busy {
- color: #d97757;
+ color: var(--agent-working);
}
.term-node__status--busy .term-node__status-dot {
@@ -1899,7 +1953,7 @@ body,
it reads as agent activity, but it carries a label + a Stop button, so it is wider than the plain
status badges. Always on — no setting hides it (decision 4). */
.term-node__status--driven {
- color: #d97757;
+ color: var(--agent-working);
max-width: 100%;
min-width: 0;
}
@@ -1933,8 +1987,8 @@ body,
}
.browser-driving__stop:hover {
- color: #d97757;
- border-color: rgba(217, 119, 87, 0.5);
+ color: var(--agent-working);
+ border-color: color-mix(in srgb, var(--state-working) 50%, transparent);
}
/* The dot's pulse is decoration; the state still reads frozen at the lit end (matches the mascot
@@ -2049,7 +2103,7 @@ body,
}
.term-node__status--loop {
- color: #bf7af0;
+ color: var(--state-automation);
}
/* DROPPED: the agent process is gone and nothing accounted for it (see agent-liveness.ts). Warn
@@ -2134,7 +2188,7 @@ body,
/* QUEUED: a node armed with canvas-control `--after`, holding its launch until the stations it
waits on go idle. Grey — it is not an alert, it is "not started yet". */
.term-node__status--queued {
- color: #8e8e93;
+ color: var(--state-queued);
gap: 4px;
}
@@ -2143,7 +2197,7 @@ body,
Amber rather than the NEEDS-YOU red: nothing is broken in the user's work, but the session they
were told would start has not, and that must not be discoverable only in a console.warn. */
.term-node__status--queued-warn {
- color: #ffb340;
+ color: var(--warn);
}
/* Copy receipt (1.6 s) — green like the base chip, and deliberately quieter than RUNNING /
@@ -2183,19 +2237,19 @@ body,
}
.term-node__approve-btn--allow {
color: var(--success);
- border-color: rgba(48, 209, 88, 0.5);
- background: rgba(48, 209, 88, 0.12);
+ border-color: color-mix(in srgb, var(--state-success) 50%, transparent);
+ background: color-mix(in srgb, var(--state-success) 12%, transparent);
}
.term-node__approve-btn--allow:hover {
- background: rgba(48, 209, 88, 0.22);
+ background: color-mix(in srgb, var(--state-success) 22%, transparent);
}
.term-node__approve-btn--deny {
color: var(--danger);
- border-color: rgba(255, 69, 58, 0.5);
- background: rgba(255, 69, 58, 0.12);
+ border-color: color-mix(in srgb, var(--state-error) 50%, transparent);
+ background: color-mix(in srgb, var(--state-error) 12%, transparent);
}
.term-node__approve-btn--deny:hover {
- background: rgba(255, 69, 58, 0.22);
+ background: color-mix(in srgb, var(--state-error) 22%, transparent);
}
@keyframes nt-pulse {
@@ -2445,7 +2499,7 @@ body,
}
.term-node__find-tag--claude {
- background: rgba(10, 132, 255, 0.22);
+ background: color-mix(in srgb, var(--accent) 22%, transparent);
color: var(--accent-text);
}
@@ -3022,7 +3076,7 @@ body,
}
.term-chat__msg--user {
align-self: flex-end;
- background: var(--accent, #0a84ff);
+ background: var(--accent);
color: #fff;
}
.term-chat__msg--assistant {
@@ -3062,7 +3116,7 @@ body,
}
.term-chat__tool-name {
font-weight: 600;
- color: var(--accent, #0a84ff);
+ color: var(--accent);
}
.term-chat__tool-arg {
overflow: hidden;
@@ -3097,7 +3151,7 @@ body,
}
.term-chat__input:focus {
outline: none;
- border-color: var(--accent, #0a84ff);
+ border-color: var(--accent);
}
.term-chat__input:disabled {
opacity: 0.5;
@@ -3483,7 +3537,7 @@ body,
padding: 1px 7px;
border-radius: 999px;
color: var(--success);
- background: rgba(48, 209, 88, 0.14);
+ background: color-mix(in srgb, var(--state-success) 14%, transparent);
}
.welcome__recent-del {
@@ -3510,7 +3564,7 @@ body,
}
.welcome__recent-del:hover {
- background: rgba(255, 69, 58, 0.15);
+ background: color-mix(in srgb, var(--state-error) 15%, transparent);
color: var(--danger);
}
@@ -3577,7 +3631,7 @@ body,
}
.ctx-item.danger:hover:not(:disabled) {
- background: rgba(247, 118, 142, 0.15);
+ background: color-mix(in srgb, var(--state-error) 15%, transparent);
}
/* Submenu row + its flyout. The flyout nests inside the row so moving the cursor across
@@ -4104,7 +4158,7 @@ body,
height: 8px;
border-radius: 50%;
background: var(--accent);
- box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.set-value {
@@ -4239,7 +4293,7 @@ body,
}
.announce-banner__btn:hover {
- background: rgba(10, 132, 255, 0.12);
+ background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.announce-banner__close {
@@ -4268,8 +4322,8 @@ body,
gap: 12px;
max-width: 560px;
padding: 6px 12px;
- background: rgba(255, 159, 10, 0.15);
- border: 1px solid rgba(255, 159, 10, 0.4);
+ background: color-mix(in srgb, var(--state-warning) 15%, transparent);
+ border: 1px solid color-mix(in srgb, var(--state-warning) 40%, transparent);
border-radius: 10px;
box-shadow: 0 8px 28px rgba(0, 0, 0, calc(0.45 * var(--shadow-k)));
font-size: 12.5px;
@@ -4280,7 +4334,7 @@ body,
flex: none;
padding: 2px 10px;
background: transparent;
- border: 1px solid rgba(255, 159, 10, 0.6);
+ border: 1px solid color-mix(in srgb, var(--state-warning) 60%, transparent);
border-radius: 7px;
color: var(--text);
font-size: 12px;
@@ -4289,22 +4343,22 @@ body,
}
.conflict-bar button:hover {
- background: rgba(255, 159, 10, 0.18);
+ background: color-mix(in srgb, var(--state-warning) 18%, transparent);
}
/* The whole-workspace save did not land. Red, not amber: the conflict bar asks a question, this
one reports that the canvas on screen is not the canvas on disk. */
.save-failure-bar {
- background: rgba(255, 69, 58, 0.15);
- border-color: rgba(255, 69, 58, 0.45);
+ background: color-mix(in srgb, var(--state-error) 15%, transparent);
+ border-color: color-mix(in srgb, var(--state-error) 45%, transparent);
}
.save-failure-bar button {
- border-color: rgba(255, 69, 58, 0.6);
+ border-color: color-mix(in srgb, var(--state-error) 60%, transparent);
}
.save-failure-bar button:hover {
- background: rgba(255, 69, 58, 0.18);
+ background: color-mix(in srgb, var(--state-error) 18%, transparent);
}
/* Direct children only — the presence facepile's face buttons are nested inside .presence-facepile
@@ -4874,16 +4928,16 @@ body,
.scm-diff .d-add {
color: var(--success);
- background: rgba(158, 206, 106, 0.08);
+ background: color-mix(in srgb, var(--state-success) 8%, transparent);
}
.scm-diff .d-del {
color: var(--danger);
- background: rgba(247, 118, 142, 0.08);
+ background: color-mix(in srgb, var(--state-error) 8%, transparent);
}
.scm-diff .d-hunk {
- color: #6ac4dc;
+ color: var(--accent-text);
}
.scm-diff .d-meta {
@@ -4941,7 +4995,7 @@ body,
.scm-message:focus {
border-color: var(--accent);
- box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.18);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.scm-gen {
@@ -4953,8 +5007,8 @@ body,
display: inline-flex;
align-items: center;
justify-content: center;
- background: rgba(10, 132, 255, 0.14);
- border: 1px solid rgba(10, 132, 255, 0.32);
+ background: color-mix(in srgb, var(--accent) 14%, transparent);
+ border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
color: var(--accent-text);
border-radius: 7px;
font-size: 13px;
@@ -4964,7 +5018,7 @@ body,
}
.scm-gen:hover:not(:disabled) {
- background: rgba(10, 132, 255, 0.26);
+ background: color-mix(in srgb, var(--accent) 26%, transparent);
}
.scm-gen:active:not(:disabled) {
@@ -5447,9 +5501,9 @@ body,
.bind-error {
margin: 0 0 12px;
padding: 8px 10px;
- border: 1px solid rgba(255, 69, 58, 0.4);
+ border: 1px solid color-mix(in srgb, var(--state-error) 40%, transparent);
border-radius: 6px;
- background: rgba(255, 69, 58, 0.12);
+ background: color-mix(in srgb, var(--state-error) 12%, transparent);
color: var(--danger);
font-size: 11px;
line-height: 1.4;
@@ -6249,7 +6303,7 @@ body,
flex-shrink: 0;
}
.palette__secondary:hover {
- background: rgba(10, 132, 255, 0.18);
+ background: color-mix(in srgb, var(--accent) 18%, transparent);
color: var(--accent-text);
}
@@ -6321,8 +6375,8 @@ body,
for this case), go muted/warning. */
.group-node--worktree-stale {
border-style: dashed;
- border-color: rgba(255, 159, 10, 0.5);
- background: rgba(255, 159, 10, 0.05);
+ border-color: color-mix(in srgb, var(--state-warning) 50%, transparent);
+ background: color-mix(in srgb, var(--state-warning) 5%, transparent);
}
/* Floating label pill, sitting on the top border (opaque so it "cuts" the dashes).
@@ -6678,7 +6732,7 @@ button.group-node__setup:disabled {
padding: 10px 12px;
background: var(--surface-deep);
border: 1px solid var(--border);
- border-left: 3px solid #bf7af0;
+ border-left: 3px solid var(--state-automation);
border-radius: 10px;
box-shadow: 0 6px 20px rgba(0, 0, 0, calc(0.4 * var(--shadow-k)));
font-size: 12px;
@@ -6718,7 +6772,7 @@ button.group-node__setup:disabled {
height: 8px;
flex: none;
border-radius: 50%;
- background: #bf7af0;
+ background: var(--state-automation);
}
.loop-node.working .loop-node__dot {
@@ -6733,7 +6787,7 @@ button.group-node__setup:disabled {
.loop-node__count {
font-size: 10.5px;
font-weight: 700;
- color: #bf7af0;
+ color: var(--state-automation);
font-variant-numeric: tabular-nums;
}
@@ -6752,16 +6806,16 @@ button.group-node__setup:disabled {
display: inline-flex;
align-items: center;
justify-content: center;
- background: rgba(191, 122, 240, 0.18);
- border: 1px solid #bf7af0;
+ background: color-mix(in srgb, var(--state-automation) 18%, transparent);
+ border: 1px solid var(--state-automation);
border-radius: 6px;
- color: #bf7af0;
+ color: var(--state-automation);
font-size: 10px;
cursor: pointer;
}
.loop-node__play:hover {
- background: rgba(191, 122, 240, 0.32);
+ background: color-mix(in srgb, var(--state-automation) 32%, transparent);
}
/* Dismiss the card (job itself is untouched). Sits at the right edge; when Play is present
@@ -6826,7 +6880,7 @@ button.group-node__setup:disabled {
}
.loop-node__item-n {
- color: #bf7af0;
+ color: var(--state-automation);
font-weight: 700;
}
@@ -6892,7 +6946,7 @@ button.group-node__setup:disabled {
`color`. */
.react-flow__controls-button.canvas-lock-btn.locked {
color: var(--accent);
- background: rgba(10, 132, 255, 0.14);
+ background: color-mix(in srgb, var(--accent) 14%, transparent);
}
/* ---- Minimap ---- */
@@ -6909,8 +6963,8 @@ button.group-node__setup:disabled {
box-shadow: 0 8px 28px rgba(0, 0, 0, calc(0.4 * var(--shadow-k)));
}
-/* Minimap-scale status glow: same language as the node glows (amber working / red
- needs-you / accent unread). A static drop-shadow provides the halo; only
+/* Minimap-scale status glow: the SAME roles as the node glows (--state-working /
+ --state-attention / --state-unread), so the map and the canvas cannot disagree. A static drop-shadow provides the halo; only
stroke-opacity animates (cheap on tiny svg rects), cadence matching each canvas glow. */
.minimap .mm-working,
.minimap .mm-attention,
@@ -6918,20 +6972,20 @@ button.group-node__setup:disabled {
stroke-width: 4px;
}
.minimap .mm-working {
- filter: drop-shadow(0 0 3px rgba(255, 214, 10, 0.8));
+ filter: drop-shadow(0 0 3px color-mix(in srgb, var(--state-working) 80%, transparent));
animation: mm-pulse-soft 2.6s ease-in-out infinite;
animation-play-state: var(--nt-anim-state);
}
.minimap .mm-attention {
- filter: drop-shadow(0 0 3px rgba(255, 69, 58, 0.9));
+ filter: drop-shadow(0 0 3px color-mix(in srgb, var(--state-attention) 90%, transparent));
animation: mm-pulse 1.8s ease-in-out infinite;
animation-play-state: var(--nt-anim-state);
}
-/* Unread = clay, the agent-hook colour (RUNNING badge, working glow). Its own keyframes: at
- minimap scale a node is a few pixels tall, so opacity alone reads as a faint flicker — the
- stroke THICKENS on the beat as well, which is what makes it findable on a busy map. */
+/* Unread: its own keyframes — at minimap scale a node is a few pixels tall, so opacity alone reads
+ as a faint flicker; the stroke THICKENS on the beat as well, which is what makes it findable on a
+ busy map (and apart from an uncoloured node's plain accent stroke). */
.minimap .mm-unread {
- filter: drop-shadow(0 0 4px rgba(217, 119, 87, 0.95));
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--state-unread) 95%, transparent));
animation: mm-pulse-unread 1.6s ease-in-out infinite;
animation-play-state: var(--nt-anim-state);
}
@@ -7830,9 +7884,9 @@ button.group-node__setup:disabled {
gap: 8px;
margin: 0 0 10px;
padding: 8px 10px;
- border: 1px solid rgba(255, 69, 58, 0.4);
+ border: 1px solid color-mix(in srgb, var(--state-error) 40%, transparent);
border-radius: 6px;
- background: rgba(255, 69, 58, 0.12);
+ background: color-mix(in srgb, var(--state-error) 12%, transparent);
}
.scm-error__msg {
flex: 1;
@@ -8012,7 +8066,7 @@ button.group-node__setup:disabled {
the header's 120px cap and `flex-shrink: 0` are what crushed the title here. Same scale as
`.ss-chip` beside it, and it yields before the name — its tooltip keeps the full label. */
.ss-account { margin-left: 0; max-width: 5.5rem; font-size: 10px; padding: 0 5px; flex: 0 1 auto; min-width: 0; }
-.ss-loop { font-size: 9.5px; color: var(--caution); border: 1px solid rgba(255, 214, 10, 0.4); border-radius: 4px; padding: 0 4px; flex: 0 0 auto; }
+.ss-loop { font-size: 9.5px; color: var(--caution); border: 1px solid color-mix(in srgb, var(--sys-yellow) 40%, transparent); border-radius: 4px; padding: 0 4px; flex: 0 0 auto; }
.ss-meta { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); min-width: 0; }
.ss-meta__cwd { font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-meta__ssh { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; }
@@ -8222,7 +8276,7 @@ button.group-node__setup:disabled {
transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.sessions-sidebar__history-item:hover .sessions-sidebar__history-del { opacity: 1; }
-.sessions-sidebar__history-del:hover { background: rgba(255, 69, 58, 0.15); color: var(--danger); }
+.sessions-sidebar__history-del:hover { background: color-mix(in srgb, var(--state-error) 15%, transparent); color: var(--danger); }
/* "Read transcript" on a closed session row (issue #531) — same reveal-on-hover affordance as the
discard ×, beside it. Kept visible while DISABLED so the reason (in its title) is reachable:
@@ -8677,7 +8731,7 @@ button.group-node__setup:disabled {
left: 0;
right: 0;
bottom: 0;
- background: rgba(255, 69, 58, 0.9);
+ background: color-mix(in srgb, var(--state-error) 90%, transparent);
color: #fff;
font-size: 12px;
padding: 4px 8px;
@@ -8850,15 +8904,15 @@ button.group-node__setup:disabled {
}
/* RUNNING matches the working spinner + node glow (clay #d97757). */
.chat-node__badge--working {
- color: #d97757;
- background: rgba(217, 119, 87, 0.15);
+ color: var(--agent-working);
+ background: color-mix(in srgb, var(--state-working) 15%, transparent);
animation: nt-pulse 1.1s ease-in-out infinite;
animation-play-state: var(--nt-anim-state);
}
/* NEEDS YOU is red everywhere (same as the terminal attention badge). */
.chat-node__badge--needs {
color: var(--danger);
- background: rgba(255, 69, 58, 0.15);
+ background: color-mix(in srgb, var(--state-error) 15%, transparent);
animation: nt-pulse 1.1s ease-in-out infinite;
animation-play-state: var(--nt-anim-state);
}
@@ -8929,8 +8983,8 @@ button.group-node__setup:disabled {
border-radius: 8px;
font-size: 12px;
color: var(--danger);
- background: rgba(255, 69, 58, 0.12);
- border: 1px solid rgba(255, 69, 58, 0.35);
+ background: color-mix(in srgb, var(--state-error) 12%, transparent);
+ border: 1px solid color-mix(in srgb, var(--state-error) 35%, transparent);
}
.chat-node__error span {
flex: 1 1 auto;
@@ -8956,8 +9010,8 @@ button.group-node__setup:disabled {
align-items: center;
gap: 10px;
padding: 8px 10px;
- border-top: 1px solid rgba(255, 69, 58, 0.35);
- background: rgba(255, 69, 58, 0.1);
+ border-top: 1px solid color-mix(in srgb, var(--state-error) 35%, transparent);
+ background: color-mix(in srgb, var(--state-error) 10%, transparent);
}
.chat-node__errorbar-msg {
flex: 1 1 auto;
@@ -8970,19 +9024,19 @@ button.group-node__setup:disabled {
font-size: 12px;
font-weight: 600;
border-radius: 6px;
- border: 1px solid rgba(255, 69, 58, 0.5);
- background: rgba(255, 69, 58, 0.15);
+ border: 1px solid color-mix(in srgb, var(--state-error) 50%, transparent);
+ background: color-mix(in srgb, var(--state-error) 15%, transparent);
color: var(--danger);
cursor: pointer;
}
.chat-node__errorbar-reconnect:hover {
- background: rgba(255, 69, 58, 0.25);
+ background: color-mix(in srgb, var(--state-error) 25%, transparent);
}
.chat-node__permission {
padding: 10px;
border-radius: 8px;
background: rgba(var(--tint-rgb), 0.04);
- border: 1px solid var(--accent, #0a84ff);
+ border: 1px solid var(--accent);
}
.chat-node__permission-title {
font-size: 12px;
@@ -9064,13 +9118,13 @@ button.group-node__setup:disabled {
font-size: 12px;
font-weight: 600;
border-radius: 6px;
- border: 1px solid rgba(255, 69, 58, 0.5);
- background: rgba(255, 69, 58, 0.15);
+ border: 1px solid color-mix(in srgb, var(--state-error) 50%, transparent);
+ background: color-mix(in srgb, var(--state-error) 15%, transparent);
color: var(--danger);
cursor: pointer;
}
.chat-node__stop:hover {
- background: rgba(255, 69, 58, 0.25);
+ background: color-mix(in srgb, var(--state-error) 25%, transparent);
}
/* Clickable diff-preview summary line on a tool card (file +n −m → opens a diff node). */
.term-chat__tool-arg--link {
@@ -9156,7 +9210,7 @@ button.group-node__setup:disabled {
cursor: pointer;
}
.chat-node__attach-chip button:hover {
- background: rgba(255, 69, 58, 0.85);
+ background: color-mix(in srgb, var(--state-error) 85%, transparent);
}
.chat-node__attach-note {
flex: 1 1 100%;
@@ -9593,7 +9647,7 @@ button.group-node__setup:disabled {
border: none;
padding: 0;
font-size: 12px;
- color: var(--accent, #0a84ff);
+ color: var(--accent);
cursor: pointer;
}
.phone-pair__footer { align-self: flex-start; }
@@ -9712,7 +9766,7 @@ button.group-node__setup:disabled {
/* Trello-style "this column will take the drop" state. */
.kanban-col--drop {
border-color: var(--accent);
- background: rgba(10, 132, 255, 0.07);
+ background: color-mix(in srgb, var(--accent) 7%, transparent);
box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(0, 0, 0, calc(0.35 * var(--shadow-k)));
}
.kanban-col__header {
@@ -9891,7 +9945,7 @@ button.group-node__setup:disabled {
color: #a371f7;
}
.github-pull-state--closed {
- color: #f85149;
+ color: var(--danger);
}
.github-pull-badge {
margin-left: 6px;
@@ -9911,7 +9965,7 @@ button.group-node__setup:disabled {
color: #a371f7;
}
.github-pull-badge--closed {
- color: #f85149;
+ color: var(--danger);
}
.github-issue-source {
flex: 0 0 auto;
@@ -10275,14 +10329,14 @@ button.group-node__setup:disabled {
}
.kanban-badge--running {
color: var(--success);
- background: rgba(50, 215, 75, 0.12);
+ background: color-mix(in srgb, var(--state-success) 12%, transparent);
/* reuse the terminal-header badge pulse (nt-pulse) rather than a bespoke keyframe */
animation: nt-pulse 1.1s ease-in-out infinite;
animation-play-state: var(--nt-anim-state);
}
.kanban-badge--needs {
color: var(--warn);
- background: rgba(255, 159, 10, 0.12);
+ background: color-mix(in srgb, var(--state-warning) 12%, transparent);
}
/* Eco: the agent CLI was exited to reclaim RAM. Quiet — the session is fine. */
.kanban-badge--sleeping {
@@ -10293,7 +10347,7 @@ button.group-node__setup:disabled {
does need the user — but for a different reason, which is why it gets its own label. */
.kanban-badge--dropped {
color: var(--warn);
- background: rgba(255, 159, 10, 0.12);
+ background: color-mix(in srgb, var(--state-warning) 12%, transparent);
}
.kanban-card__unread {
width: 7px;
@@ -10323,7 +10377,7 @@ button.group-node__setup:disabled {
.kanban-add-col:hover {
color: var(--text-strong);
border-color: var(--accent);
- background: rgba(10, 132, 255, 0.06);
+ background: color-mix(in srgb, var(--accent) 6%, transparent);
}
@@ -10376,7 +10430,7 @@ button.group-node__setup:disabled {
.kanban-col__new:hover {
color: var(--text-strong);
border-color: var(--accent);
- background: rgba(10, 132, 255, 0.08);
+ background: color-mix(in srgb, var(--accent) 8%, transparent);
}
/* GitHub Issues settings — the "Advanced" (token/provider) disclosure. Collapsed by default so the
common gh-signed-in case shows no token noise. */
@@ -11343,7 +11397,7 @@ button.group-node__setup:disabled {
color: rgba(var(--tint-rgb), 0.75);
}
.kanban-due--overdue {
- background: rgba(255, 69, 58, 0.18);
+ background: color-mix(in srgb, var(--state-error) 18%, transparent);
color: #ff6961;
}
.kanban-card__metarow {
@@ -12229,7 +12283,7 @@ button.group-node__setup:disabled {
width: 8px;
height: 8px;
border-radius: 50%;
- background: rgb(48, 209, 88);
+ background: var(--state-success);
animation: onb-blob 1.6s ease-in-out infinite;
animation-play-state: var(--nt-anim-state);
}
@@ -12265,8 +12319,8 @@ button.group-node__setup:disabled {
margin-left: auto;
font-size: 9px;
font-weight: 600;
- color: #0a84ff;
- background: rgba(10, 132, 255, 0.18);
+ color: var(--accent);
+ background: color-mix(in srgb, var(--accent) 18%, transparent);
border-radius: 4px;
padding: 1px 5px;
}
@@ -12576,7 +12630,7 @@ button.group-node__setup:disabled {
inset: 6px;
border: 2px dashed var(--accent);
border-radius: 8px;
- background: rgba(10, 132, 255, 0.06);
+ background: color-mix(in srgb, var(--accent) 6%, transparent);
pointer-events: none;
z-index: 3;
}
@@ -13039,10 +13093,10 @@ body.focus-mode .dock:hover {
border-radius: 999px;
border: 1px solid transparent;
}
-.trigger-node__chip--armed { color: #30d158; border-color: rgba(48, 209, 88, 0.5); }
-.trigger-node__chip--disarmed { color: #8e8e93; border-color: rgba(142, 142, 147, 0.5); }
-.trigger-node__chip--changed { color: #ff9f0a; border-color: rgba(255, 159, 10, 0.5); }
-.trigger-node__chip--invalid { color: #ff9f0a; border-color: rgba(255, 159, 10, 0.5); }
+.trigger-node__chip--armed { color: var(--success); border-color: color-mix(in srgb, var(--state-success) 50%, transparent); }
+.trigger-node__chip--disarmed { color: var(--state-queued); border-color: color-mix(in srgb, var(--state-queued) 50%, transparent); }
+.trigger-node__chip--changed { color: var(--warn); border-color: color-mix(in srgb, var(--state-warning) 50%, transparent); }
+.trigger-node__chip--invalid { color: var(--warn); border-color: color-mix(in srgb, var(--state-warning) 50%, transparent); }
.trigger-node__body {
flex: 1 1 auto;
overflow-y: auto;
@@ -13069,7 +13123,7 @@ body.focus-mode .dock:hover {
}
.trigger-node__state-line,
.trigger-node__note { color: rgba(255, 255, 255, 0.55); font-size: 11px; }
-.trigger-node__error { color: #ff9f0a; font-size: 11px; }
+.trigger-node__error { color: var(--warn); font-size: 11px; }
.trigger-node__row { display: flex; gap: 6px; }
.trigger-node__row button {
background: rgba(255, 255, 255, 0.08);
@@ -13106,9 +13160,9 @@ body.focus-mode .dock:hover {
border: 1px solid transparent;
text-transform: uppercase;
}
-.trigger-node__run-chip--ok { color: #30d158; border-color: rgba(48, 209, 88, 0.5); }
-.trigger-node__run-chip--warn { color: #ff9f0a; border-color: rgba(255, 159, 10, 0.5); }
-.trigger-node__run-chip--muted { color: #8e8e93; border-color: rgba(142, 142, 147, 0.5); }
+.trigger-node__run-chip--ok { color: var(--success); border-color: color-mix(in srgb, var(--state-success) 50%, transparent); }
+.trigger-node__run-chip--warn { color: var(--warn); border-color: color-mix(in srgb, var(--state-warning) 50%, transparent); }
+.trigger-node__run-chip--muted { color: var(--state-queued); border-color: color-mix(in srgb, var(--state-queued) 50%, transparent); }
.trigger-node__run-time { color: rgba(255, 255, 255, 0.45); font-size: 10px; }
.trigger-node__confirm { display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 12px; }
.trigger-node__confirm .trigger-node__payload { max-height: 140px; }
diff --git a/src/renderer/styles.palette.test.ts b/src/renderer/styles.palette.test.ts
new file mode 100644
index 000000000..5439729bd
--- /dev/null
+++ b/src/renderer/styles.palette.test.ts
@@ -0,0 +1,112 @@
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+import { describe, expect, it } from 'vitest'
+import { SYSTEM_COLORS } from './lib/palette'
+import { gitStatusColor } from './lib/gitStatusColors'
+
+// The semantic colour system (styles.css `--sys-*` palette + `--state-*` / `--git-*` roles): every
+// role resolves to a colour in every theme, the JS table and the CSS agree, and each meaning has
+// ONE source that every surface drawing it reads.
+
+const read = (rel: string): string => readFileSync(join(__dirname, rel), 'utf8').replace(/\r\n/g, '\n')
+const CSS = read('styles.css')
+
+/** The declarations of the first rule whose selector line matches exactly. */
+function block(selector: string): Map<string, string> {
+ const start = CSS.indexOf(`\n${selector} {\n`)
+ expect(start, selector).toBeGreaterThanOrEqual(0)
+ const end = CSS.indexOf('\n}\n', start)
+ const body = CSS.slice(start, end).replace(/\/\*[\s\S]*?\*\//g, '')
+ return new Map(Array.from(body.matchAll(/^\s*(--[a-z0-9-]+)\s*:\s*([^;]+);/gm), (m) => [m[1], m[2].trim()]))
+}
+
+const DARK = block(':root')
+const LIGHT = new Map([...DARK, ...block(":root[data-theme='light']")])
+const THEMES = { dark: DARK, light: LIGHT }
+
+/** Follow var() chains; true when every reference bottoms out in a literal colour. */
+function resolves(value: string, tokens: Map<string, string>, depth = 0): boolean {
+ if (depth > 10) return false
+ const refs = Array.from(value.matchAll(/var\(\s*(--[a-z0-9-]+)\s*\)/g), (m) => m[1])
+ if (refs.length === 0) return /#[0-9a-f]{3,8}\b|rgba?\(|transparent/i.test(value)
+ return refs.every((r) => tokens.has(r) && resolves(tokens.get(r)!, tokens, depth + 1))
+}
+
+const ROLES = [
+ '--state-working',
+ '--state-attention',
+ '--state-unread',
+ '--state-error',
+ '--state-success',
+ '--state-warning',
+ '--state-queued',
+ '--state-automation',
+ '--git-modified',
+ '--git-added',
+ '--git-deleted',
+ '--git-renamed',
+ '--git-conflict'
+]
+
+describe('palette tokens', () => {
+ for (const [theme, tokens] of Object.entries(THEMES)) {
+ it(`every semantic role resolves to a colour (${theme})`, () => {
+ for (const role of ROLES) expect(resolves(tokens.get(role) ?? '', tokens), `${role} in ${theme}`).toBe(true)
+ })
+
+ it(`--sys-* matches lib/palette.ts (${theme})`, () => {
+ for (const [name, hex] of Object.entries(SYSTEM_COLORS[theme as 'dark' | 'light'])) {
+ expect(tokens.get(`--sys-${name}`), `--sys-${name}`).toBe(hex)
+ }
+ })
+ }
+
+ it('no rule outside the token blocks spells a status hue as a literal', () => {
+ // The hues the audit found hand-typed at ~200 sites. Brand clay stays legal on the two
+ // Claude-identity surfaces (subagent node, usage pill) and the onboarding decoration.
+ const rules = CSS.slice(CSS.indexOf('\n}\n', CSS.search(/^:root\[data-theme='light'\]/m)))
+ .replace(/\/\*[\s\S]*?\*\//g, '')
+ const hits = rules.match(
+ /rgba?\(\s*(255,\s*69,\s*58|10,\s*132,\s*255|48,\s*209,\s*88|255,\s*159,\s*10|191,\s*122,\s*240|217,\s*119,\s*87)|#(ff453a|30d158|32d74b|ff9f0a|bf7af0|ffb340|f85149|8e8e93)\b/gi
+ )
+ expect(hits ?? []).toEqual([])
+ })
+})
+
+describe('git status colours have one source', () => {
+ it('both git panels draw from lib/gitStatusColors', () => {
+ for (const f of ['components/SourceControlPanel.tsx', 'components/git-history/GitHistoryCommitFiles.tsx']) {
+ const src = read(f)
+ expect(src, f).toContain('gitStatusColor(')
+ expect(src, f).not.toMatch(/STATUS_COLOR|'#[0-9a-f]{6}'/i)
+ }
+ })
+
+ it('every status resolves to a defined role token, unknown to the label colour', () => {
+ for (const s of ['M', 'A', 'D', 'R', 'U']) {
+ const v = gitStatusColor(s)
+ expect(v).toMatch(/^var\(--git-/)
+ expect(resolves(v, DARK)).toBe(true)
+ }
+ expect(gitStatusColor('??')).toBe('var(--text)')
+ })
+})
+
+describe('minimap status strokes match the node glows', () => {
+ const canvas = read('canvas/Canvas.tsx')
+ const pairs = [
+ ['working', "st?.state === 'working') return 'var(--state-working)'"],
+ ['attention', "st?.state === 'blocked') return 'var(--state-attention)'"],
+ ['unread', "st?.unread) return 'var(--state-unread)'"]
+ ] as const
+
+ for (const [state, stroke] of pairs) {
+ it(`${state}: the canvas glow, the minimap stroke and its halo read --state-${state}`, () => {
+ expect(canvas).toContain(stroke)
+ const glow = CSS.slice(CSS.indexOf(`.react-flow__node:has(.term-node.${state})::after {`))
+ expect(glow.slice(0, glow.indexOf('}'))).toContain(`var(--state-${state})`)
+ const mm = CSS.slice(CSS.lastIndexOf(`.minimap .mm-${state} {`))
+ expect(mm.slice(0, mm.indexOf('}'))).toContain(`var(--state-${state})`)
+ })
+ }
+})