refactor(@projects/@magic-civilization): 🎨 tokenize ui menu colours (p2-74 cluster 5)

Route scenes/ui/ingame_menu.gd (4) and scenes/ui/lens_switcher.gd (4)
off inline Color() literals onto existing design tokens (no token
additions, no theme rebuild needed).

- ingame_menu save status: green/red → semantic.positive / semantic.negative.
- lens_switcher active-lens font → semantic.positive; panel bg →
  background.deepest (alpha 0.82 preserved) + border → border.panel.
- Wrap two _show_status calls to satisfy max-line-length.

Both files gdlint-clean; all token refs resolve. 0 inline Color() remain.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-06-15 22:17:49 -05:00
parent fd5d6f1e88
commit 1b67eba7b4
3 changed files with 30 additions and 9 deletions

View file

@ -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.

View file

@ -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:

View file

@ -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