diff --git a/.project/designs/design-tokens.json b/.project/designs/design-tokens.json index a45cff59..bee5a366 100644 --- a/.project/designs/design-tokens.json +++ b/.project/designs/design-tokens.json @@ -567,5 +567,17 @@ }, "breakpoint": { "mobile": { "$value": "768px", "$type": "dimension", "$description": "Guide app mobile breakpoint" } + }, + "typeVariations": { + "_doc": "Godot Theme type variations (p2-87). Widgets set theme_type_variation to INHERIT a font colour instead of calling add_theme_color_override. base = base widget type; fontColor = a color token name resolved at build time. Emitted into ui_theme.tres by build-ui-theme.py.", + "LabelTitle": { "base": "Label", "fontColor": "text.title" }, + "LabelMuted": { "base": "Label", "fontColor": "text.muted" }, + "LabelSecondary": { "base": "Label", "fontColor": "text.secondary" }, + "LabelDisabled": { "base": "Label", "fontColor": "text.disabled" }, + "LabelPositive": { "base": "Label", "fontColor": "semantic.positive" }, + "LabelNegative": { "base": "Label", "fontColor": "semantic.negative" }, + "LabelWarning": { "base": "Label", "fontColor": "semantic.warning" }, + "LabelGold": { "base": "Label", "fontColor": "accent.gold" }, + "LabelScience": { "base": "Label", "fontColor": "accent.science" } } } diff --git a/public/games/age-of-dwarves/ui_theme.tres b/public/games/age-of-dwarves/ui_theme.tres index 005ecc61..7b62f3d1 100644 --- a/public/games/age-of-dwarves/ui_theme.tres +++ b/public/games/age-of-dwarves/ui_theme.tres @@ -126,3 +126,21 @@ ItemList/styles/selected = SubResource("StyleBoxFlat_item_list_selected") ItemList/styles/selected_focus = SubResource("StyleBoxFlat_item_list_selected") RichTextLabel/colors/default_color = Color(0.878431, 0.847059, 0.784314, 1) RichTextLabel/font_sizes/normal_font_size = 14 +LabelDisabled/base_type = &"Label" +LabelDisabled/colors/font_color = Color(0.501961, 0.501961, 0.4, 0.501961) +LabelGold/base_type = &"Label" +LabelGold/colors/font_color = Color(0.85098, 0.627451, 0.12549, 1) +LabelMuted/base_type = &"Label" +LabelMuted/colors/font_color = Color(0.698039, 0.698039, 0.698039, 1) +LabelNegative/base_type = &"Label" +LabelNegative/colors/font_color = Color(0.85098, 0.34902, 0.25098, 1) +LabelPositive/base_type = &"Label" +LabelPositive/colors/font_color = Color(0.4, 0.901961, 0.4, 1) +LabelScience/base_type = &"Label" +LabelScience/colors/font_color = Color(0.4, 0.74902, 1, 1) +LabelSecondary/base_type = &"Label" +LabelSecondary/colors/font_color = Color(0.74902, 0.717647, 0.65098, 1) +LabelTitle/base_type = &"Label" +LabelTitle/colors/font_color = Color(0.94902, 0.85098, 0.45098, 1) +LabelWarning/base_type = &"Label" +LabelWarning/colors/font_color = Color(0.901961, 0.6, 0.2, 1) diff --git a/tools/build-ui-theme.py b/tools/build-ui-theme.py index 7d37f8f4..8c37e98e 100644 --- a/tools/build-ui-theme.py +++ b/tools/build-ui-theme.py @@ -347,6 +347,16 @@ def build_theme_text(tokens: dict) -> str: f"RichTextLabel/font_sizes/normal_font_size = {fs_sm}", ] + # Type variations (p2-87): inheritance targets so widgets can set + # theme_type_variation instead of add_theme_color_override. Skips _doc. + variations = tokens.get("typeVariations", {}) + for vname in sorted(variations): + if vname.startswith("_"): + continue + spec: dict = variations[vname] + resource_lines.append('%s/base_type = &"%s"' % (vname, spec["base"])) + resource_lines.append("%s/colors/font_color = %s" % (vname, c(spec["fontColor"]))) + parts = [ f'[gd_resource type="Theme" format=3 uid="{THEME_UID}"]', "",