refactor(@projects/@magic-civilization): 🎨 knowledge_tree labels inherit via theme_type_variation (p2-87 pilot)

First override→inheritance migration, proving the pattern. Replace 4
add_theme_color_override("font_color", ...) calls with theme_type_variation:
cost→LabelMuted, hint→LabelDisabled, title→LabelTitle, flavor→LabelSecondary.
Widgets now 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 tech_tree_proof — cost labels render the muted colour correctly, tree
unchanged. Remaining accent-param labels (_make_pill/_make_section) stay as
overrides (dynamic colour). The redundant text.primary overrides (= Label
default) are a separate delete-pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-06-19 02:50:37 -05:00
parent 54767fbd98
commit b26116acc9

View file

@ -466,7 +466,7 @@ func _create_node_card(
var cost_label: Label = Label.new()
cost_label.text = "%s: %d" % [ThemeVocabulary.lookup(_cost_unit_vocab_key()), cost]
cost_label.add_theme_font_size_override("font_size", 12)
cost_label.add_theme_color_override("font_color", ThemeAssets.color("text.muted"))
cost_label.theme_type_variation = "LabelMuted"
inner_vbox.add_child(cost_label)
var counts: Dictionary = _count_unlocks(node_data.get("unlocks", {}))
@ -575,7 +575,7 @@ func _rebuild_detail() -> void:
if _web == null or _selected_node_id.is_empty():
var hint: Label = Label.new()
hint.text = _hint_text()
hint.add_theme_color_override("font_color", ThemeAssets.color("text.disabled"))
hint.theme_type_variation = "LabelDisabled"
hint.add_theme_font_size_override("font_size", 12)
hint.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
hint.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
@ -592,7 +592,7 @@ func _rebuild_detail() -> void:
node_name = String(node_data.get("name", _selected_node_id))
title.text = node_name
title.add_theme_font_size_override("font_size", 20)
title.add_theme_color_override("font_color", ThemeAssets.color("text.title"))
title.theme_type_variation = "LabelTitle"
title.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_detail_vbox.add_child(title)
@ -759,7 +759,7 @@ func _make_flavor_block(text: String) -> PanelContainer:
var lbl: Label = Label.new()
lbl.text = text
lbl.add_theme_font_size_override("font_size", 12)
lbl.add_theme_color_override("font_color", ThemeAssets.color("text.secondary"))
lbl.theme_type_variation = "LabelSecondary"
lbl.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
p.add_child(lbl)
return p