make-hashed-project

Make hashed project bar colors richer and readable

Metadata

Statusdone
Assignedagent-735
Modelpi:zai:glm-5.2
Created2026-07-23T19:23:44.567902483+00:00
Started2026-07-25T13:46:03.209149254+00:00
Completed2026-07-25T14:15:00.920939783+00:00
Tokens22343571 in / 41382 out

Description

Objective

Stop washing every hash-derived project color into a very light pastel. Preserve stronger project identity while guaranteeing readable foreground contrast. The current problem is not the deterministic hash; it is the overly narrow lightness/chroma mapping applied to the bar.

Required behavior

  • Keep project-color derivation deterministic, asynchronous, and stable across worktrees for the same canonical project identity. Different projects should retain useful visual distinction.
  • Preserve substantially more hashed hue/chroma instead of unconditionally mixing toward white or selecting only pastel tones.
  • Choose background tone and foreground as a contrast-safe pair. Never render dark text on a background too dark to read, nor light text on a background too light to read.
  • If the contextual bar intentionally retains dark foreground text, select the richest/darkest background that still clears an explicit luminance/contrast floor. If the renderer supports adaptive foreground safely, use light text for genuinely dark hash colors rather than forcing every background pastel.
  • Apply a measurable contrast target to actual terminal colors (target WCAG-like 4.5:1 for normal text where representable) and provide a deterministic compatibility fallback for reduced 256/16-color palettes.
  • Preserve semantic status/error/selection colors and focus indication; project identity color must not make controls, exact IDs, search, pulse, or service context ambiguous.
  • Do not infer terminal capability from unreliable font/color appearance. Respect explicit compatibility/theme modes and light/dark themes.
  • Color computation and stale-result rejection remain off the frame-critical path; a result for an old graph/project may not recolor the current bar.

Validation

  • Exhaustive/property tests over a large hash sample prove foreground/background contrast and show a materially broader lightness/chroma distribution than the current pastel-only mapping.
  • Same canonical project across root/worktree/nested invocation produces the same identity color; distinct projects remain distinguishable within palette limits.
  • Truecolor, 256-color, 16-color compatibility, light theme, dark theme, desktop, tmux, mosh, and Termux screenshots/buffers remain readable.
  • Resize, graph switch, service reconnect, and async completion reject stale colors without flicker or blocking.
  • Existing one-row geometry, exact hit regions, status semantics, and project-color stability tests remain green.
  • Run fmt, clippy, focused/full tests and owned visual smoke. Never globally install an unmerged candidate.

Depends on

Required by

Log