refactor(@projects/@magic-civilization): 🎨 statistics screen labels → theme_type_variation (p2-87 override→inheritance)

Migrate 15 add_theme_color_override("font_color", ...) calls in statistics.gd to
theme_type_variation (LabelTitle/Secondary/Muted/Disabled/Positive/Negative).
Widgets inherit the colour from ui_theme.tres instead of hand-setting it.

Value-preserving (variations carry the same token colours). Render-verified on
plum via statistics_proof — all 5 tabs render; Rankings shows title gold, metric
secondary, trend arrows green, no regressions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-06-19 04:12:47 -05:00
parent 1cb6a657ea
commit a86aa6f67c

View file

@ -123,7 +123,7 @@ func _build_modal() -> void:
title_lbl.text = ThemeVocabulary.lookup("statistics_title")
title_lbl.size_flags_horizontal = Control.SIZE_EXPAND_FILL
title_lbl.add_theme_font_size_override("font_size", 20)
title_lbl.add_theme_color_override("font_color", ThemeAssets.color("text.title"))
title_lbl.theme_type_variation = "LabelTitle"
title_row.add_child(title_lbl)
_close_button = Button.new()
@ -221,7 +221,7 @@ func _build_graphs_tab(parent: Control) -> void:
_graph_metric_label.custom_minimum_size.x = 200
_graph_metric_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_graph_metric_label.add_theme_font_size_override("font_size", 15)
_graph_metric_label.add_theme_color_override("font_color", ThemeAssets.color("text.secondary"))
_graph_metric_label.theme_type_variation = "LabelSecondary"
ctrl_row.add_child(_graph_metric_label)
var next_btn: Button = Button.new()
@ -259,7 +259,7 @@ func _build_rankings_tab(parent: Control) -> void:
_rank_metric_label.custom_minimum_size.x = 200
_rank_metric_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_rank_metric_label.add_theme_font_size_override("font_size", 15)
_rank_metric_label.add_theme_color_override("font_color", ThemeAssets.color("text.secondary"))
_rank_metric_label.theme_type_variation = "LabelSecondary"
ctrl_row.add_child(_rank_metric_label)
var next_btn: Button = Button.new()
@ -300,7 +300,7 @@ func _build_histories_tab(parent: Control) -> void:
_hist_notice.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_hist_notice.text = ThemeVocabulary.lookup("statistics_histories_pending")
_hist_notice.add_theme_font_size_override("font_size", 15)
_hist_notice.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
_hist_notice.theme_type_variation = "LabelMuted"
panel.add_child(_hist_notice)
@ -402,7 +402,7 @@ func _add_demo_row(
cat_lbl.custom_minimum_size.x = 160
cat_lbl.size_flags_vertical = Control.SIZE_SHRINK_CENTER
cat_lbl.add_theme_font_size_override("font_size", 13)
cat_lbl.add_theme_color_override("font_color", ThemeAssets.color("text.secondary"))
cat_lbl.theme_type_variation = "LabelSecondary"
row.add_child(cat_lbl)
var val_lbl: Label = Label.new()
@ -424,7 +424,7 @@ func _add_demo_row(
rank_lbl.add_theme_color_override("font_color", _rank_colors[ci])
else:
rank_lbl.text = "--"
rank_lbl.add_theme_color_override("font_color", ThemeAssets.color("text.disabled"))
rank_lbl.theme_type_variation = "LabelDisabled"
row.add_child(rank_lbl)
var best_lbl: Label = Label.new()
@ -433,7 +433,7 @@ func _add_demo_row(
best_lbl.size_flags_vertical = Control.SIZE_SHRINK_CENTER
best_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
best_lbl.add_theme_font_size_override("font_size", 13)
best_lbl.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
best_lbl.theme_type_variation = "LabelMuted"
row.add_child(best_lbl)
var avg_lbl: Label = Label.new()
@ -442,7 +442,7 @@ func _add_demo_row(
avg_lbl.size_flags_vertical = Control.SIZE_SHRINK_CENTER
avg_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
avg_lbl.add_theme_font_size_override("font_size", 13)
avg_lbl.add_theme_color_override("font_color", ThemeAssets.color("text.disabled"))
avg_lbl.theme_type_variation = "LabelDisabled"
row.add_child(avg_lbl)
_demo_list.add_child(row)
@ -521,7 +521,7 @@ func _add_axis_label(pos: Vector2, text: String) -> void:
lbl.text = text
lbl.position = pos
lbl.add_theme_font_size_override("font_size", 10)
lbl.add_theme_color_override("font_color", ThemeAssets.color("text.disabled"))
lbl.theme_type_variation = "LabelDisabled"
_graph_area.add_child(lbl)
@ -532,7 +532,7 @@ func _add_graph_placeholder(text: String) -> void:
lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
lbl.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
lbl.add_theme_font_size_override("font_size", 16)
lbl.add_theme_color_override("font_color", ThemeAssets.color("text.disabled"))
lbl.theme_type_variation = "LabelDisabled"
_graph_area.add_child(lbl)
@ -630,13 +630,13 @@ func _add_rank_row(
match trend:
1:
trend_lbl.text = ThemeVocabulary.lookup("trend_up")
trend_lbl.add_theme_color_override("font_color", ThemeAssets.color("semantic.positive"))
trend_lbl.theme_type_variation = "LabelPositive"
-1:
trend_lbl.text = ThemeVocabulary.lookup("trend_down")
trend_lbl.add_theme_color_override("font_color", ThemeAssets.color("semantic.negative"))
trend_lbl.theme_type_variation = "LabelNegative"
_:
trend_lbl.text = ThemeVocabulary.lookup("trend_flat")
trend_lbl.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
trend_lbl.theme_type_variation = "LabelMuted"
row.add_child(trend_lbl)
_rank_list.add_child(row)
@ -647,7 +647,7 @@ func _add_rank_placeholder(text: String) -> void:
lbl.text = text
lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
lbl.add_theme_font_size_override("font_size", 15)
lbl.add_theme_color_override("font_color", ThemeAssets.color("text.disabled"))
lbl.theme_type_variation = "LabelDisabled"
_rank_list.add_child(lbl)
@ -681,7 +681,7 @@ func _add_header_label(
lbl.text = text
lbl.custom_minimum_size.x = min_w
lbl.add_theme_font_size_override("font_size", 12)
lbl.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
lbl.theme_type_variation = "LabelMuted"
if right_align:
lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
parent.add_child(lbl)