Skip to content

feat(terminal): first-class Ghostty + Termux support; adopt upstream AAA palette - #107

Merged
Rynaro merged 2 commits into
mainfrom
feat/terminal-ghostty-termux
Jun 9, 2026
Merged

Rynaro merged 2 commits into
mainfrom
feat/terminal-ghostty-termux

Conversation

@Rynaro

@Rynaro Rynaro commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Makes terminal emulators first-class in Potions — Ghostty (Linux/macOS) and Termux (Android) — with live theme rotation and quality-of-life wiring, and adopts the upstream alchemists-orchid.ghostty palette as the canonical theme.

Built on three product decisions:

  1. Adopt the upstream palette as canonical (Nord-based, WCAG-AAA, astigmatism-friendly) across every surface.
  2. Manage Ghostty's config via a backup + config-file include.
  3. Configure-only — Potions never installs an emulator, only themes one that is present.

Palette — single source of truth

The upstream palette becomes the SoT for shell / NeoVim / Zellij / terminals. The theme system's design made this clean: the resolver whitelist already accepts any COLOR_* token and the compiler auto-emits every .color entry, so adding an explicit ANSI-16 + cursor/selection layer to the .tokens.json sources is pure data — no parser/compiler logic change. All three variants (dark #2e3440, white = upstream light #fafbfc, sepia #f5f0e6) are now byte-faithful to the upstream theme. Semantic tokens + nvim component shades retuned to the same hue family.

Adapters

  • shell / Zellij / terminal adapters read the explicit COLOR_ANSI_* tokens (byte-faithful per variant) + cursor/selection; shell adds OSC 12 (cursor).
  • Ghostty output split: ghostty-colors (palette + cursor/selection, per theme) and a managed ghostty.conf (config-file include + QoL: cursor-style, unfocused-split-opacity, shell-integration, macos-option-as-alt, Zellij tab keybinds).
  • New theme_gen_adapter_termux writes ~/.termux/colors.properties and applies it live via termux-reload-settings; self-gates to a no-op off-Termux. Added to the generator targets.

potions terminal command

New .potions/lib/terminal/manager.sh (mirrors theme/manager.sh): configure-only, idempotent, backup-first wiring.

  • terminal setup [ghostty|termux|all|--auto] — wires the Ghostty include and the Termux extra-keys row.
  • terminal status — reports detection + wiring.
  • install.sh / upgrade.sh run terminal setup --auto after theme regen; bin/potions routes terminal; both help paths list theme + terminal.

Docs

  • TERMINAL_SETUP.md gains first-class Ghostty + Termux sections; README note.
  • docs/color-palette.md regenerated.

Test plan

  • ./test.sh249/249 pass (new: ANSI-16 faithfulness, Ghostty cursor/selection + managed config, Termux colors.properties on/off gate, terminal-setup idempotency + backup).
  • scripts/compile-themes.sh --check clean; --docs in sync.
  • End-to-end smoke through bin/potions: theme cycle repaints all surfaces; terminal setup ghostty backs up + wires once (idempotent); all three variants byte-faithful.
  • .version 2.13.1 → 2.14.0; .checksums regenerated, sorted, no drift (install.sh, upgrade.sh, bin/potions changed).
  • .gitignore allowlists .potions/lib/terminal/ (default-deny tree — would not ship otherwise).

🤖 Generated with Claude Code

Rynaro and others added 2 commits June 9, 2026 09:50
…AAA palette

Make terminal emulators first-class in Potions: Ghostty (Linux/macOS) and
Termux (Android), with live theme rotation and quality-of-life wiring.

Palette (source of truth):
- Adopt the upstream alchemists-orchid.ghostty Nord-based, WCAG-AAA,
  astigmatism-friendly palette as the canonical SoT across every surface.
- Add an explicit ANSI-16 + cursor/selection token layer to the .tokens.json
  sources (no resolver/compiler logic change — the whitelist already accepts
  arbitrary COLOR_* and the compiler auto-emits every .color entry). Recompile
  all .theme files; retune the semantic tokens + nvim component shades to the
  same hue family; regenerate docs/color-palette.md.

Adapters:
- shell/zellij/terminal adapters now read the explicit COLOR_ANSI_* tokens
  (byte-faithful per variant) plus cursor/selection; shell adds OSC 12 (cursor).
- Ghostty output split: ghostty-colors (palette + cursor/selection, per theme)
  and a managed ghostty.conf (config-file include + QoL: cursor-style,
  unfocused-split-opacity, shell-integration, macos-option-as-alt, Zellij
  tab keybinds).
- New theme_gen_adapter_termux writes ~/.termux/colors.properties and applies
  it live via termux-reload-settings; self-gates to a no-op off-Termux. Added
  to the generator targets.

Wiring (configure-only, never installs an emulator):
- New `potions terminal` command (.potions/lib/terminal/manager.sh): setup
  [ghostty|termux|all|--auto] backs up and idempotently wires the Ghostty
  config-file include and the Termux extra-keys row; status reports detection.
- install.sh/upgrade.sh run `terminal setup --auto` after theme regen.
- bin/potions routes `terminal`; help.sh/fallback help list theme + terminal.

Docs/tests/release:
- TERMINAL_SETUP.md gains first-class Ghostty + Termux sections; README note.
- test.sh: ANSI-16 faithfulness, Ghostty cursor/selection + managed config,
  Termux colors.properties (on/off gate), terminal setup idempotency + backup.
- Allowlist .potions/lib/terminal in .gitignore; bump .version 2.13.1 -> 2.14.0
  and regenerate .checksums (install.sh, upgrade.sh, bin/potions changed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Ghostty wiring test created a fixture under $HOME/.config/ghostty but did
not control XDG_CONFIG_HOME. On runners that preset XDG_CONFIG_HOME (Ubuntu CI),
the manager correctly resolved the Ghostty config to $XDG_CONFIG_HOME instead of
the fixture, so wiring did not touch the asserted file and the test failed
(passed on macOS/Fedora/Termux where XDG_CONFIG_HOME is unset). The manager is
correct — honoring XDG_CONFIG_HOME is the right behavior; the test was not
hermetic. Pin XDG_CONFIG_HOME to the fixture in every manager invocation, and
fix the `grep -c || echo 0` double-count (use `grep -Fc ... || true`).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Rynaro
Rynaro merged commit 80aa7a2 into main Jun 9, 2026
7 checks passed
@Rynaro
Rynaro deleted the feat/terminal-ghostty-termux branch June 9, 2026 13:31
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