# Shared theme variable contract for tunacode and nextstep palettes

> Established a single variable schema for both Textual themes so base TCSS can stay theme-agnostic and avoid missing-variable runtime paths.

- Skill: `tools-only/shared-theme-variable-contract-for-tunacode-and-nextstep` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/shared-theme-variable-contract-for-tunacode-and-nextstep`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/shared-theme-variable-contract-for-tunacode-and-nextstep/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-29
- Page: https://skillmd.com/skills/tools-only/shared-theme-variable-contract-for-tunacode-and-nextstep

---


# Shared theme variable contract for tunacode and nextstep palettes

## Summary

Established a single variable schema for both Textual themes so base TCSS can stay theme-agnostic and avoid missing-variable runtime paths.

## Changes

- Updated `src/tunacode/constants.py`:
  - Added `THEME_VARIABLE_CONTRACT` mapping variable names to palette keys.
  - Added `_build_theme_variables()` with fail-fast validation for missing palette keys.
  - Added missing shared palette keys to both `UI_COLORS` and `NEXTSTEP_COLORS`:
    - `bevel_light`
    - `bevel_dark`
    - `scrollbar_thumb`
    - `scrollbar_track`
  - Updated `build_tunacode_theme()` and `build_nextstep_theme()` to emit `variables` from the same contract.
  - Removed now-unused `NEXTSTEP_COLORS` entries (`window_content`, `title_bar`, `title_bar_text`).
- Added `tests/unit/ui/test_theme_variable_contract.py` to verify:
  - both palettes include all required keys,
  - both theme builders emit identical variable schemas,
  - variable values map correctly from each palette.

## Verification

- `uv run ruff check src/tunacode/constants.py tests/unit/ui/test_theme_variable_contract.py`
- `uv run pytest tests/unit/ui/test_theme_variable_contract.py -q`

Result: pass.

