fix: 2.3.0 accent regression — store ANSI escapes, not hex; clamp user-box width #45

Merged
owlburtoe merged 1 commit from clfy-fix-accent-ansi into master 2026-07-16 19:08:11 -04:00
Owner

What broke

2.3.0's accent override wrote hex into theme.fgColors.accent. pi's Theme stores ready-made ANSI escapes there — fg() concatenates verbatim — so every accent surface rendered literal #B1B9F9 text, which widened pi's update banner past the terminal width; pi's TUI throws on overflow and crashed the session (Rendered line 7 exceeds terminal width).

Fixes

  • Accent stores escapes precomputed for both color modes: truecolor 38;2;… and pi's own rgbTo256 quantization (dark → 147, matching the live CC capture; light → 63), selected by theme.mode. Dark/light detection now parses ANSI text colors (truecolor triple, 256 cube, grayscale ramp).
  • User-message box (theme mode) was silently falling back to the CC gray because it expected hex from bgColors — the theme's stored bg escape now passes through, so custom themes actually get their own color.
  • Overflow hardening: the box's +1 right padding clamps to the render width — pi throws on overflow rather than clipping.
  • Test fakes now mirror real pi themes (ANSI escapes + mode); new assertions: no raw hex ever reaches fgColors, 256-color quantization, width clamp.
  • Postmortem in docs/plans/2026-07-16-cc-accent-color.md; new CLAUDE.md convention: mutating pi structures requires a live pi smoke test before every release — the assembled-render suites validate claudify's own output, not pi's format contracts.

Test plan

  • Full suite 15/15 green; tsc --noEmit --strict clean.
  • Live pi smoke test before publishing 2.3.1 (the new release gate — Berto).
## What broke 2.3.0's accent override wrote **hex** into `theme.fgColors.accent`. pi's `Theme` stores **ready-made ANSI escapes** there — `fg()` concatenates verbatim — so every accent surface rendered literal `#B1B9F9` text, which widened pi's update banner past the terminal width; pi's TUI throws on overflow and crashed the session (`Rendered line 7 exceeds terminal width`). ## Fixes - **Accent** stores escapes precomputed for both color modes: truecolor `38;2;…` and pi's own `rgbTo256` quantization (dark → `147`, matching the live CC capture; light → `63`), selected by `theme.mode`. Dark/light detection now parses ANSI text colors (truecolor triple, 256 cube, grayscale ramp). - **User-message box (theme mode)** was silently falling back to the CC gray because it expected hex from `bgColors` — the theme's stored bg escape now passes through, so custom themes actually get their own color. - **Overflow hardening**: the box's +1 right padding clamps to the render width — pi throws on overflow rather than clipping. - Test fakes now mirror real pi themes (ANSI escapes + `mode`); new assertions: no raw hex ever reaches `fgColors`, 256-color quantization, width clamp. - Postmortem in `docs/plans/2026-07-16-cc-accent-color.md`; new CLAUDE.md convention: **mutating pi structures requires a live pi smoke test before every release** — the assembled-render suites validate claudify's own output, not pi's format contracts. ## Test plan - [x] Full suite 15/15 green; `tsc --noEmit --strict` clean. - [ ] Live pi smoke test before publishing 2.3.1 (the new release gate — Berto).
fix: store ANSI escapes, not hex, when overriding theme colors; clamp user box width
All checks were successful
Plane Sync / Close referenced Plane work items (pull_request) Successful in 2s
c672fb2f2f
pi's Theme stores ready-made ANSI escapes in fgColors/bgColors — fg()/bg()
concatenate verbatim — so 2.3.0's accent override (hex) rendered literal
#B1B9F9 text on every accent surface and widened pi's update banner past the
terminal width, crashing the renderer (TUI throws on overflow). The accent now
stores escapes precomputed for both color modes (truecolor + pi's rgbTo256:
dark 147, light 63); dark/light detection parses ANSI text colors. The
user-message box passes the theme's stored bg escape through (it was silently
falling back to CC gray) and clamps its +1 right padding to the render width.
Test fakes now mirror real pi themes (escapes + mode).
owlburtoe merged commit a129329404 into master 2026-07-16 19:08:11 -04:00
owlburtoe deleted branch clfy-fix-accent-ansi 2026-07-16 19:08:11 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
owlburtoe/pi-claudify!45
No description provided.