diff --git a/.project/objectives/p2-74-ui-dehardcode-to-tokens.md b/.project/objectives/p2-74-ui-dehardcode-to-tokens.md index ffbc998f..40a1ce1e 100644 --- a/.project/objectives/p2-74-ui-dehardcode-to-tokens.md +++ b/.project/objectives/p2-74-ui-dehardcode-to-tokens.md @@ -97,7 +97,20 @@ always-green. Order by player visibility: HUD/world-map → city → combat → file. Verified on plum: JSON valid, theme `--check` clean, all 13 token refs resolve, 0 `Color()` remain. Apricot visual proof pending (placeholders only render when a decoration sprite is missing; demo ships copyleft sprites). -- **Remaining**: minimap (`scenes/hud/minimap.*`) is **already compliant** — its +- **Cluster 5** (UI menus) — landed. `scenes/ui/ingame_menu.gd` (4) + + `scenes/ui/lens_switcher.gd` (4) → 0 inline `Color()`. Mapped to **existing** + tokens (no token additions, no theme rebuild): save-status green/red → + `semantic.positive`/`semantic.negative`; active-lens font → `semantic.positive`; + lens panel bg → `background.deepest` (alpha 0.82 preserved) + border → + `border.panel`. Both files gdlint-clean. All refs resolve. +- **Remaining**: `world_map/arena_overlay.gd` (2 player-slot literals — candidate + for `player.blue`/`player.orange`, pending a check of whether they're seeded + elsewhere) is the last straightforward convertible. Everything else is a + **legitimate carve-out** (allowed by acceptance bullet 2): computed alpha-variants + of a base/player colour (`courier_route_overlay` L30/31 + L102 ring, + `arena_playback` L260/270/281, `world_map_units` L86), token-seeded `_ready()` + fallbacks (`courier_route_overlay` L19/20), and an identity-modulate reset + (`tile_info_panel` L200 `Color(1,1,1,1)`). minimap (`scenes/hud/minimap.*`) is 23 `Color()` are the documented `TERRAIN_COLORS` game-content exception (Rail-2 follow-up, OOS for this visual pass) + token-seeded `_ready()` fallbacks; `world_map_hud.*` / `weather_visualizer.*` / `encyclopedia_panel.*` already 0. diff --git a/src/game/engine/scenes/ui/ingame_menu.gd b/src/game/engine/scenes/ui/ingame_menu.gd index 87eab37a..e590b4d6 100644 --- a/src/game/engine/scenes/ui/ingame_menu.gd +++ b/src/game/engine/scenes/ui/ingame_menu.gd @@ -50,9 +50,12 @@ func _on_quick_save() -> void: var turn: int = GameState.turn_number var err: Error = SaveManagerScript.save_to_named_slot("quicksave") if err == OK: - _show_status(ThemeVocabulary.lookup("fmt_saved_turn") % turn, Color(0.3, 0.9, 0.4)) + _show_status( + ThemeVocabulary.lookup("fmt_saved_turn") % turn, + ThemeAssets.color("semantic.positive"), + ) else: - _show_status(ThemeVocabulary.lookup("save_failed"), Color(0.9, 0.3, 0.3)) + _show_status(ThemeVocabulary.lookup("save_failed"), ThemeAssets.color("semantic.negative")) func _on_save() -> void: @@ -61,9 +64,12 @@ func _on_save() -> void: var slot: String = "save_t%d_%s" % [turn, timestamp] var err: Error = SaveManagerScript.save_to_named_slot(slot) if err == OK: - _show_status(ThemeVocabulary.lookup("fmt_saved_slot") % slot, Color(0.3, 0.9, 0.4)) + _show_status( + ThemeVocabulary.lookup("fmt_saved_slot") % slot, + ThemeAssets.color("semantic.positive"), + ) else: - _show_status(ThemeVocabulary.lookup("save_failed"), Color(0.9, 0.3, 0.3)) + _show_status(ThemeVocabulary.lookup("save_failed"), ThemeAssets.color("semantic.negative")) func _on_load() -> void: diff --git a/src/game/engine/scenes/ui/lens_switcher.gd b/src/game/engine/scenes/ui/lens_switcher.gd index 822773dd..27758541 100644 --- a/src/game/engine/scenes/ui/lens_switcher.gd +++ b/src/game/engine/scenes/ui/lens_switcher.gd @@ -252,9 +252,9 @@ func _update_button_states() -> void: var btn: Button = _buttons_by_id[key] as Button var active: bool = (key == _active_lens_id) if active: - btn.add_theme_color_override("font_color", Color(0.15, 0.9, 0.4, 1.0)) + btn.add_theme_color_override("font_color", ThemeAssets.color("semantic.positive")) btn.add_theme_color_override( - "font_pressed_color", Color(0.15, 0.9, 0.4, 1.0) + "font_pressed_color", ThemeAssets.color("semantic.positive") ) else: btn.remove_theme_color_override("font_color") @@ -295,8 +295,10 @@ func _cycle(direction: int) -> void: func _apply_panel_style() -> void: var style: StyleBoxFlat = StyleBoxFlat.new() - style.bg_color = Color(0.05, 0.05, 0.08, 0.82) - style.border_color = Color(0.25, 0.22, 0.12, 0.85) + var panel_bg: Color = ThemeAssets.color("background.deepest") + panel_bg.a = 0.82 + style.bg_color = panel_bg + style.border_color = ThemeAssets.color("border.panel") style.set_border_width_all(1) style.set_corner_radius_all(3) style.content_margin_left = 6