Skip to content

Light adaptation follow-ups: palette provenance, minimum-contrast, settings, iOS - #66

Merged
jamesyong-42 merged 2 commits into
mainfrom
feat/light-adaptation-followups
Oct 3, 2026
Merged

jamesyong-42 merged 2 commits into
mainfrom
feat/light-adaptation-followups

Conversation

@jamesyong-42

@jamesyong-42 jamesyong-42 commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Follow-ups to #65.

What changes

  • Palette provenance in frames. TRF1 section 13 (StylePalette) records which palette index a style's explicit color came from. Additive: old decoders skip it and render the same RGB; it is omitted when no style has provenance. Style ids include provenance only when present, so ANSI red and the same RGB as truecolor stay two definitions. The phase-1 golden frame (native/ghosttea/fixtures/phase1/ansi-baseline.json) is regenerated for this intentional TRF1 change; TS and Swift decoders both read it.
  • Palette-aware light adaptation. Under a light theme, chromatic ANSI colors (1–6, 9–14) keep the light theme's exact palette entry when legible on the remapped surface; neutral entries (0/7/8/15) still remap by role.
  • minimum-contrast (Ghostty key, 1–21) is applied to text glyphs and underline/strikethrough. It keeps hue and moves OKLab lightness only as far as needed (Ghostty snaps to black/white). Box drawing, block elements, and color glyphs are exempt, as in Ghostty.
  • ghosttea-light-adaptation = auto|off — first Ghosttea extension key, accepted beside the generated Ghostty schema (known-keys.txt stays untouched). Both settings flow through RendererConfig, the remote TerminalPresentationConfig, and protocol validation.
  • Settings → Appearance → Readability on desktop (checkbox + contrast slider) and iOS (toggle + Off/3/4.5/7 picker), written into the managed appearance block. Importing a Ghostty config carries minimum-contrast.
  • iOS / Metal port of all of the above.

Verification

  • Rust: clippy clean, cargo test --workspace green (incl. new frame and config tests).
  • TS: frame 13, protocol 24, react 279, desktop 33 tests; lint, prettier, type checks clean.
  • Swift: 96 tests (frame/core/appearance) against a native core built from this branch.
  • Desktop, real app: Grok under a light theme renders light; ANSI accents show the exact Catppuccin Latte palette entries; Settings applies minimum-contrast and the adaptation toggle live.
  • iOS simulator (iPhone 17 Pro): the production config loader, native core, and GhostteaTerminalMetalView render a dark-painted scene and recorded Grok output as a light design; off, minimum-contrast = 4.5, and the Readability settings screen all checked visually.

Expected CI notes

  • audit-published will flag that the pinned Apple native artifact predates these native changes; it needs the usual rebuild/pin at the next release. Until then, devices on the published artifact won't see section 13 or the new keys.
  • dependency-audit failures are pre-existing (also failing on main).

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

jamesyong-42 and others added 2 commits October 2, 2026 22:54
…tting

TRF1 gains section 13 (StylePalette): for styles whose explicit colors came
from the terminal palette, the palette index beside the resolved RGB. It is
additive — old decoders skip it and render the same RGB — and omitted when no
style has provenance. Style ids include provenance only when present, so one
RGB reached by palette and by truecolor stays two definitions. The phase-1
golden frame is regenerated for that intentional change.

Light adaptation keeps a light theme's own chromatic ANSI colors (1–6, 9–14)
when they stay legible on the remapped surface; neutral entries still remap
by role.

`minimum-contrast` (Ghostty key, 1–21) is now applied to text glyphs and their
decorations, hue-preserving rather than snapping to black or white; box
drawing, block elements, and color glyphs are exempt.

`ghosttea-light-adaptation = auto|off` is the first Ghosttea extension key,
accepted beside the pinned Ghostty schema. Both settings reach remote views
through the terminal presentation, the protocol validates them, and Settings
→ Appearance → Readability writes them into the managed block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in Metal

Ports the WebGPU remap to GhostteaMetalRenderer: the TRF1 decoder reads
section 13, the theme carries the two new settings from the presentation
config, styles resolve once per mesh with text/fill colors, and the adaptation
key joins the geometry and row-cache keys. Settings → Appearance gains a
Readability section that writes the same keys as the desktop.

Verified in the iOS simulator against a core built from this branch; the
published Apple native artifact needs its next rebuild before devices see
section 13 or the new keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jamesyong-42
jamesyong-42 merged commit d2327c8 into main Oct 3, 2026
8 of 10 checks passed
@jamesyong-42
jamesyong-42 deleted the feat/light-adaptation-followups branch October 3, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant