refactor(@projects/@magic-civilization): 🎨 migrate 19 scenes' Label colours to theme_type_variation (p2-87 override→inheritance)

Node-type-aware batch: replace add_theme_color_override("font_color",
ThemeAssets.color("<token>")) with theme_type_variation on declared Label vars
only (35 overrides across 19 HUD/menu/notification/world-map scenes). Non-Label
targets (Buttons in top_bar/overlay_panel/lens_switcher) and dynamic/param
colours are left as overrides — a Label variation would break a Button's
stylebox lookup.

Value-preserving (each variation carries the identical token colour; instance
font_size overrides are untouched). All changed files gdlint-clean. Pattern is
render-proven by the statistics + hotkey_sheet iterations; live world_map render
skipped here because the working tree carries a concurrent session's uncommitted
world_map.gd / tile_info_panel edits (left unstaged).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-06-19 04:27:37 -05:00
parent 3f82ff6fb5
commit dc78a15670
19 changed files with 35 additions and 35 deletions

View file

@ -590,5 +590,5 @@ func _populate_grudge_badge(atk: RefCounted, def: RefCounted) -> void:
badge.add_to_group("grudge_badge")
badge.text = ThemeVocabulary.lookup("combat_grudge_badge")
badge.add_theme_font_size_override("font_size", 13)
badge.add_theme_color_override("font_color", ThemeAssets.color("semantic.negative"))
badge.theme_type_variation = "LabelNegative"
add_child(badge)

View file

@ -142,7 +142,7 @@ func _build_find_ui() -> void:
_find_label = Label.new()
_find_label.text = ""
_find_label.add_theme_font_size_override("font_size", 12)
_find_label.add_theme_color_override("font_color", ThemeAssets.color("text.secondary"))
_find_label.theme_type_variation = "LabelSecondary"
row.add_child(_find_label)
var vbox: VBoxContainer = null

View file

@ -100,7 +100,7 @@ func _make_rival_row(player: RefCounted) -> Control:
header.custom_minimum_size = Vector2(240, 0)
header.text = _format_rival_header(player)
header.add_theme_font_size_override("font_size", 15)
header.add_theme_color_override("font_color", ThemeAssets.color("text.title"))
header.theme_type_variation = "LabelTitle"
hbox.add_child(header)
var relation_label: Label = Label.new()
relation_label.custom_minimum_size = Vector2(100, 0)
@ -231,7 +231,7 @@ func _make_agreement_section(target_idx: int) -> Control:
status_text,
]
lbl.add_theme_font_size_override("font_size", 13)
lbl.add_theme_color_override("font_color", ThemeAssets.color("semantic.positive"))
lbl.theme_type_variation = "LabelPositive"
vbox.add_child(lbl)
has_any = true
if not has_any:

View file

@ -78,7 +78,7 @@ func _build_ui() -> void:
_empty_label = Label.new()
_empty_label.text = "No intercepted envelopes yet."
_empty_label.add_theme_font_size_override("font_size", 13)
_empty_label.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
_empty_label.theme_type_variation = "LabelMuted"
_body.add_child(_empty_label)

View file

@ -110,7 +110,7 @@ func _build_view_center_section() -> void:
var view_label: Label = Label.new()
view_label.text = ThemeVocabulary.lookup("view_center")
view_label.add_theme_font_size_override("font_size", 10)
view_label.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
view_label.theme_type_variation = "LabelMuted"
add_child(view_label)
_btn_view_equator = Button.new()

View file

@ -74,7 +74,7 @@ func _build_ui() -> void:
_processing_label.name = "ProcessingLabel"
_processing_label.text = ThemeVocabulary.lookup("action_processing")
_processing_label.add_theme_font_size_override("font_size", 28)
_processing_label.add_theme_color_override("font_color", ThemeAssets.color("text.title"))
_processing_label.theme_type_variation = "LabelTitle"
_processing_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_processing_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
_processing_label.set_anchors_preset(Control.PRESET_CENTER)
@ -115,7 +115,7 @@ func _build_ui() -> void:
header.name = "LogHeader"
header.text = "%s Summary" % ThemeVocabulary.lookup("turn")
header.add_theme_font_size_override("font_size", 20)
header.add_theme_color_override("font_color", ThemeAssets.color("text.title"))
header.theme_type_variation = "LabelTitle"
header.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
outer_vbox.add_child(header)
@ -144,7 +144,7 @@ func _build_ui() -> void:
hint.name = "DismissHint"
hint.text = ThemeVocabulary.lookup("dismiss_hint")
hint.add_theme_font_size_override("font_size", 12)
hint.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
hint.theme_type_variation = "LabelMuted"
hint.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
outer_vbox.add_child(hint)
@ -227,7 +227,7 @@ func _rebuild_log_entries() -> void:
var more_label: Label = Label.new()
more_label.text = ThemeVocabulary.lookup("fmt_and_n_more") % hidden_count
more_label.add_theme_font_size_override("font_size", 13)
more_label.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
more_label.theme_type_variation = "LabelMuted"
_log_vbox.add_child(more_label)

View file

@ -113,12 +113,12 @@ func _build_ui() -> void:
_title_label = Label.new()
_title_label.add_theme_font_size_override("font_size", 24)
_title_label.add_theme_color_override("font_color", ThemeAssets.color("text.title"))
_title_label.theme_type_variation = "LabelTitle"
vbox.add_child(_title_label)
_step_counter_label = Label.new()
_step_counter_label.add_theme_font_size_override("font_size", 12)
_step_counter_label.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
_step_counter_label.theme_type_variation = "LabelMuted"
vbox.add_child(_step_counter_label)
_body_label = Label.new()
@ -180,9 +180,9 @@ func _render_step() -> void:
func _render_action_badge(prefix: String) -> void:
if _step_satisfied:
_action_badge.text = ThemeVocabulary.lookup("tutorial_action_done")
_action_badge.add_theme_color_override("font_color", ThemeAssets.color("semantic.positive"))
_action_badge.theme_type_variation = "LabelPositive"
return
_action_badge.add_theme_color_override("font_color", ThemeAssets.color("semantic.warning"))
_action_badge.theme_type_variation = "LabelWarning"
var action_hint: String = ThemeVocabulary.lookup("%s_action" % prefix)
var header: String = ThemeVocabulary.lookup("tutorial_action_required")
_action_badge.text = ThemeVocabulary.lookup("fmt_tutorial_badge") % [header, action_hint]

View file

@ -620,7 +620,7 @@ func _refresh_items() -> void:
var slot_label: Label = Label.new()
slot_label.text = "%s[%s]" % [tier_tag, category.left(3).to_upper()]
slot_label.add_theme_font_size_override("font_size", 10)
slot_label.add_theme_color_override("font_color", ThemeAssets.color("accent.gold"))
slot_label.theme_type_variation = "LabelGold"
row_hbox.add_child(slot_label)
var name_label: Label = Label.new()
@ -633,7 +633,7 @@ func _refresh_items() -> void:
var charges_label: Label = Label.new()
charges_label.text = "(%d)" % charges
charges_label.add_theme_font_size_override("font_size", 10)
charges_label.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
charges_label.theme_type_variation = "LabelMuted"
row_hbox.add_child(charges_label)
vbox.add_child(row)

View file

@ -226,7 +226,7 @@ func _build_patrol_banner() -> void:
_patrol_banner_label = Label.new()
_patrol_banner_label.name = "PatrolBannerLabel"
_patrol_banner_label.add_theme_font_size_override("font_size", 15)
_patrol_banner_label.add_theme_color_override("font_color", ThemeAssets.color("accent.science"))
_patrol_banner_label.theme_type_variation = "LabelScience"
_patrol_banner_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_patrol_banner_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_patrol_banner.add_child(_patrol_banner_label)
@ -263,7 +263,7 @@ func _build_rally_command_picker() -> void:
var title: Label = Label.new()
title.text = ThemeVocabulary.lookup("rally_command_pick_title")
title.add_theme_font_size_override("font_size", 13)
title.add_theme_color_override("font_color", ThemeAssets.color("accent.science"))
title.theme_type_variation = "LabelScience"
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
vbox.add_child(title)

View file

@ -28,7 +28,7 @@ func _populate() -> void:
if sections.is_empty():
var missing: Label = Label.new()
missing.text = ThemeVocabulary.lookup("credits_missing")
missing.add_theme_color_override("font_color", ThemeAssets.color("semantic.warning"))
missing.theme_type_variation = "LabelWarning"
_content_vbox.add_child(missing)
return
for section_variant: Variant in sections:
@ -169,7 +169,7 @@ func _build_section(section: Dictionary) -> Control:
var heading: Label = Label.new()
heading.text = str(section.get("heading", "")).to_upper()
heading.add_theme_font_size_override("font_size", 16)
heading.add_theme_color_override("font_color", ThemeAssets.color("text.title"))
heading.theme_type_variation = "LabelTitle"
box.add_child(heading)
var rule: ColorRect = ColorRect.new()
rule.custom_minimum_size = Vector2(0, 1)

View file

@ -133,7 +133,7 @@ func _make_header(text: String, is_name_col: bool = false) -> Label:
var lbl: Label = Label.new()
lbl.text = text
lbl.add_theme_font_size_override("font_size", 13)
lbl.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
lbl.theme_type_variation = "LabelMuted"
if not is_name_col:
lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
return lbl

View file

@ -122,10 +122,10 @@ func _populate_hero_strip() -> void:
var player_is_winner: bool = _winner_index == human_idx
if player_is_winner:
_banner_label.text = ThemeVocabulary.lookup("endgame_banner_victory")
_banner_label.add_theme_color_override("font_color", ThemeAssets.color("accent.gold"))
_banner_label.theme_type_variation = "LabelGold"
else:
_banner_label.text = ThemeVocabulary.lookup("endgame_banner_defeat")
_banner_label.add_theme_color_override("font_color", ThemeAssets.color("semantic.negative"))
_banner_label.theme_type_variation = "LabelNegative"
# Append per-reason flavour when the vocabulary key is mapped.
var reason_key: String = "endgame_reason_" + _reason

View file

@ -276,7 +276,7 @@ func _make_controller_row(slot_idx: int) -> Control:
var label: Label = Label.new()
label.text = "AI Slot %d" % slot_idx
label.add_theme_font_size_override("font_size", 11)
label.add_theme_color_override("font_color", ThemeAssets.color("text.secondary"))
label.theme_type_variation = "LabelSecondary"
label.custom_minimum_size = Vector2(80, 0)
row.add_child(label)
var picker: OptionButton = OptionButton.new()
@ -360,7 +360,7 @@ func _make_clan_row(slot_idx: int, clan: Dictionary) -> Control:
desc.text = str(clan.get("description", ""))
desc.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
desc.add_theme_font_size_override("font_size", 11)
desc.add_theme_color_override("font_color", ThemeAssets.color("text.secondary"))
desc.theme_type_variation = "LabelSecondary"
vbox.add_child(desc)
vbox.add_child(_build_axes_row(clan.get("strategic_axes", {})))
return panel
@ -375,7 +375,7 @@ func _build_axes_row(axes: Dictionary) -> HBoxContainer:
var label: Label = Label.new()
label.text = ThemeVocabulary.lookup("axis_%s" % key)
label.add_theme_font_size_override("font_size", 10)
label.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
label.theme_type_variation = "LabelMuted"
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
cell.add_child(label)
var value: Label = Label.new()

View file

@ -51,7 +51,7 @@ func _populate(ids: Array[String]) -> void:
var desc_label: Label = Label.new()
desc_label.text = dec.get("description", "")
desc_label.add_theme_font_size_override("font_size", 11)
desc_label.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
desc_label.theme_type_variation = "LabelMuted"
desc_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
text_col.add_child(desc_label)
_spoils_list.add_child(row)

View file

@ -46,11 +46,11 @@ func _on_victory_achieved(player_index: int, victory_type: String) -> void:
_player_label.text = ThemeVocabulary.lookup("turn_limit_reached")
elif player != null and player.is_human:
_result_label.text = ThemeVocabulary.lookup("victory").to_upper()
_result_label.add_theme_color_override("font_color", ThemeAssets.color("accent.gold"))
_result_label.theme_type_variation = "LabelGold"
_player_label.text = "%s %s" % [_player_display(player), ThemeVocabulary.lookup("wins")]
else:
_result_label.text = ThemeVocabulary.lookup("defeat").to_upper()
_result_label.add_theme_color_override("font_color", ThemeAssets.color("semantic.negative"))
_result_label.theme_type_variation = "LabelNegative"
_player_label.text = "%s %s" % [_player_display(player), ThemeVocabulary.lookup("wins")]
_condition_label.text = _victory_banner(victory_type, stalemate)
@ -152,7 +152,7 @@ func _make_header(text: String, is_name_col: bool = false) -> Label:
var lbl: Label = Label.new()
lbl.text = text
lbl.add_theme_font_size_override("font_size", 13)
lbl.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
lbl.theme_type_variation = "LabelMuted"
if not is_name_col:
lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
return lbl

View file

@ -51,14 +51,14 @@ func _build_ui() -> void:
_title_label = Label.new()
_title_label.text = TITLE_DEFAULT
_title_label.add_theme_font_size_override("font_size", 42)
_title_label.add_theme_color_override("font_color", ThemeAssets.color("semantic.negative"))
_title_label.theme_type_variation = "LabelNegative"
_title_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
vbox.add_child(_title_label)
_subtitle_label = Label.new()
_subtitle_label.text = SUBTITLE_DEFAULT
_subtitle_label.add_theme_font_size_override("font_size", 22)
_subtitle_label.add_theme_color_override("font_color", ThemeAssets.color("text.title"))
_subtitle_label.theme_type_variation = "LabelTitle"
_subtitle_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
vbox.add_child(_subtitle_label)

View file

@ -49,7 +49,7 @@ func _ready() -> void:
_title = Label.new()
_title.add_theme_font_size_override("font_size", 16)
_title.add_theme_color_override("font_color", ThemeAssets.color("text.title"))
_title.theme_type_variation = "LabelTitle"
col.add_child(_title)
_body = Label.new()

View file

@ -53,7 +53,7 @@ func build(
var title: Label = Label.new()
title.text = "%s · seed %d" % [match_id, seed_value]
title.add_theme_color_override("font_color", ThemeAssets.color("accent.gold"))
title.theme_type_variation = "LabelGold"
title.add_theme_font_size_override("font_size", 13)
_p1_label = _make_player_label(p1, _p0_color)

View file

@ -96,7 +96,7 @@ func draw_waypoint_overlay(parent_node: Node2D, waypoints: Array) -> void:
flag_label.add_to_group("patrol_overlay")
flag_label.text = str(i + 1)
flag_label.add_theme_font_size_override("font_size", 13)
flag_label.add_theme_color_override("font_color", ThemeAssets.color("accent.science"))
flag_label.theme_type_variation = "LabelScience"
flag_label.position = pixel + Vector2(-6.0, -20.0)
parent_node.add_child(flag_label)