Skip to content

Encapsulate game palettes in theme styles - #74

Merged
bashmohandes merged 2 commits into
masterfrom
codex/encapsulate-theme-styles-and-interface
Aug 16, 2026
Merged

Encapsulate game palettes in theme styles#74
bashmohandes merged 2 commits into
masterfrom
codex/encapsulate-theme-styles-and-interface

Conversation

@bashmohandes

Copy link
Copy Markdown
Owner

Motivation

  • Remove per-game hard-coded palettes and centralize game-rendering colors in theme styles so new themes can be added without modifying game code.
  • Provide a stable contract for canvas games to consume theme-owned tokens rather than selecting a theme or embedding light/dark palettes.

Description

  • Move Battle Tanks palette values into theme CSS as --battle-* custom properties in styles/modern-game.css and scope them for the game via .game-battle-tanks selectors.
  • Replace the in-code palette lookup in battle-tanks/scripts/app.js with a computed-style adapter that reads battle tokens from getComputedStyle(arena) and builds arenaColors dynamically.
  • Document the contract in docs/adr/0008-experience-theming-system.md stating that theme styles expose game rendering tokens and canvas games must read computed properties.
  • Add a regression test in tests/appearance-system.test.js to assert the presence of --battle-* tokens and ensure the Battle Tanks script reads computed styles and no longer contains the embedded palettes table.

Testing

  • Ran npm run check which completed without runtime syntax errors for the modified scripts and modules.
  • Ran the full test suite with npm test and the focused tests with npm test -- --test-name-pattern='theme styles own|alternative themes', and all targeted tests passed.

Codex Task

@bashmohandes
bashmohandes merged commit 3e46f0a into master Aug 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant