Repository navigation
EN Theme System
LeoMiniGames uses one host-owned runtime theme contract. Games should consume semantic tokens/surfaces instead of creating a second independent theme engine.
Prefer semantic Constants properties or alias.* lookups over literal presentation values. The system covers colors, spacing, padding/gaps, dimensions/breakpoints, radii/borders/focus, typography, opacity/scale/motion, elevation/shadows, touch targets, application/card/dialog metrics and game HUD/tile/inventory/virtual-control presentation.
The current built-in theme documentation records 300+ base color tokens, 1,600+ total tokens and 5,000+ aliases. Aliases are the stable semantic contract; primitive tokens are implementation detail.
ThemeManager owns the active theme. External games use the public GameTheme facade (with ThemeRuntime alias in the external service map). Private application QML modules are not the external plugin contract. Theme changes increment runtime revision so bindings can update without restart when authored correctly.
The host stores one active theme ID. Applying a theme replaces that ID. The built-in theme remains the fallback. Installed UI/runtime paths prevent unsafe removal of the active theme and provide fallback behavior.
Theme packages are data-only RCCs, separate from game/mod RCCs:
/theme/theme.json
/theme/assets/...
Allowed content is limited to theme data and supported assets. QML, JavaScript, native libraries and executable payloads are rejected. Market downloads use HTTPS/integrity/package-size checks before installation.
External themes cannot override protected primitive families such as metric.unit.*, metric.ratio.* and metric.data.*. Gameplay rules—board dimensions as rules, scoring, RNG, economy, difficulty logic—belong to game code/state, not theme data. A visual package must not silently change game balance.
External games query semantic values through GameTheme.color(), number(), value() and surface() or ship their own reusable components that resolve the same aliases. Legacy games are not required to become theme-aware solely to remain loadable; modern Level 2 games should generally use the shared contract.
Test runtime theme switching, missing token/surface fallback, long localized text, high DPI, small mobile screens, focus/hover/touch states and a theme that intentionally omits optional values. Theme failure should not corrupt gameplay state.
The repository file docs/THEMING.md still carries a historical “0.6.2” heading; this wiki treats its current theme contract as source material but does not mislabel that heading as the v0.7 API version.
LeoMiniGames v0.7.0 · Home · Languages · Source Audit · audited against f340c22db5ba