Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
class_name ThemeDialog
|
|
|
|
|
extends ModalCard
|
|
|
|
|
## View ▾ → Theme…: pick a theme set, edit its colours, background and panel
|
|
|
|
|
## fills, pattern and logo, and save it as your own. "Use theme" restyles the
|
|
|
|
|
## app (Main reloads its UI; the open spread is kept).
|
|
|
|
|
|
|
|
|
|
var m: Main
|
|
|
|
|
var _sets: Array[Dictionary] = []
|
|
|
|
|
## The set being edited: a deep copy with every colour filled in.
|
|
|
|
|
var _work: Dictionary = {}
|
|
|
|
|
var _dirty := false
|
|
|
|
|
var _picker: OptionButton
|
|
|
|
|
var _content: VBoxContainer
|
2026-11-14 14:26:39 -06:00
|
|
|
var _delete_button: Button
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
var _more := false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _init(p_main: Main) -> void:
|
|
|
|
|
super._init("Theme", 640.0)
|
|
|
|
|
m = p_main
|
|
|
|
|
var top := HBoxContainer.new()
|
|
|
|
|
top.add_theme_constant_override("separation", 10)
|
|
|
|
|
body.add_child(top)
|
|
|
|
|
_picker = OptionButton.new()
|
|
|
|
|
_picker.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
_picker.item_selected.connect(func(i: int) -> void: _load(_sets[i]))
|
|
|
|
|
ModalCard.style_popup(_picker.get_popup())
|
|
|
|
|
top.add_child(_picker)
|
|
|
|
|
_content = VBoxContainer.new()
|
|
|
|
|
_content.add_theme_constant_override("separation", 14)
|
|
|
|
|
body.add_child(_content)
|
2026-11-14 14:26:39 -06:00
|
|
|
_delete_button = add_button("Delete", "plain", _delete)
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
add_button("Save as new…", "plain", _save_as_new)
|
|
|
|
|
add_button("Close", "plain", close)
|
|
|
|
|
add_button("Use theme", "primary", _use)
|
|
|
|
|
_refresh_sets(str(ThemeStore.current.get("id", ThemeStore.DEFAULT_ID)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _refresh_sets(select_id: String) -> void:
|
|
|
|
|
_sets = ThemeStore.all()
|
|
|
|
|
_picker.clear()
|
|
|
|
|
var at := 0
|
|
|
|
|
for i in _sets.size():
|
|
|
|
|
var t := _sets[i]
|
|
|
|
|
_picker.add_item(str(t.get("name", "?")) + (" (built in)" if t.get("builtin", false) else ""))
|
|
|
|
|
if str(t.get("id", "")) == select_id:
|
|
|
|
|
at = i
|
|
|
|
|
_picker.select(at)
|
|
|
|
|
_load(_sets[at])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _load(t: Dictionary) -> void:
|
|
|
|
|
_work = t.duplicate(true)
|
|
|
|
|
_work["colors"] = ThemeStore.resolved_colors(t)
|
|
|
|
|
_dirty = false
|
|
|
|
|
_rebuild()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _rebuild() -> void:
|
|
|
|
|
for c in _content.get_children():
|
|
|
|
|
c.queue_free()
|
2026-11-14 14:26:39 -06:00
|
|
|
# Built-in themes can't be deleted, so they don't offer it.
|
|
|
|
|
if _delete_button:
|
|
|
|
|
_delete_button.visible = not bool(_work.get("builtin", false))
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
if bool(_work.get("builtin", false)):
|
|
|
|
|
_content.add_child(ModalCard.note("This theme is built in. Changes to it are saved as a new theme of your own."))
|
|
|
|
|
var bg := FillEditor.new(_work.get("background", {}), _color("BG"))
|
|
|
|
|
bg.changed.connect(func() -> void: _put("background", bg.fill))
|
|
|
|
|
_content.add_child(ModalCard.field("Background", bg))
|
|
|
|
|
var panel := FillEditor.new(_work.get("panel", {}), _color("PANEL"))
|
|
|
|
|
panel.changed.connect(func() -> void: _put("panel", panel.fill))
|
|
|
|
|
_content.add_child(ModalCard.field("Panels (top bar and tray)", panel))
|
|
|
|
|
var row := HBoxContainer.new()
|
|
|
|
|
row.add_theme_constant_override("separation", 24)
|
|
|
|
|
row.add_child(ModalCard.field("Background pattern", _choice(ThemeStore.PATTERNS, "pattern", "dots")))
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
row.add_child(ModalCard.field("Card border", _choice(_offered(ThemeStore.CARD_FRAMES, "art", _work.has("frame")), "card_frame", "plain")))
|
|
|
|
|
var logo := _choice(_offered(ThemeStore.LOGOS, "mascot", _work.has("mascot")), "logo", "none")
|
|
|
|
|
logo.item_selected.connect(func(_i: int) -> void: _rebuild.call_deferred())
|
|
|
|
|
row.add_child(ModalCard.field("Logo", logo))
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
_content.add_child(row)
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
if str(_work.get("logo", "")) in ["fortune_teller", "mascot"]:
|
|
|
|
|
_content.add_child(_mascot_colors())
|
|
|
|
|
if not bool(_work.get("builtin", false)) and _work.has("id"):
|
|
|
|
|
_content.add_child(_folder_row())
|
Theme fonts: 13 bundled families and text/title pickers in the theme editor
Standard (Inter, Source Sans 3, Lora, Rokkitt), easy to read (Atkinson
Hyperlegible, Lexend, Andika, OpenDyslexic) and themed title faces (Cinzel,
IM Fell English, Uncial Antiqua, Orbitron, Special Elite). All OFL except
Special Elite (Apache 2.0); licence files sit beside the fonts. FontCatalog
builds faces, synthesising missing bold/italic.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:16:39 -06:00
|
|
|
_content.add_child(_font_row())
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
_content.add_child(ModalCard.section("Colours"))
|
|
|
|
|
var grid := GridContainer.new()
|
|
|
|
|
grid.columns = 2
|
|
|
|
|
grid.add_theme_constant_override("h_separation", 14)
|
|
|
|
|
grid.add_theme_constant_override("v_separation", 6)
|
|
|
|
|
_content.add_child(grid)
|
|
|
|
|
for r: Array in ThemeStore.TOKENS:
|
|
|
|
|
if bool(r[2]) or _more:
|
|
|
|
|
var tok: String = r[0]
|
|
|
|
|
grid.add_child(FillEditor.swatch(_color(tok), func(c: Color) -> void:
|
|
|
|
|
(_work["colors"] as Dictionary)[tok] = "#" + c.to_html(true)
|
|
|
|
|
_dirty = true))
|
|
|
|
|
grid.add_child(ModalCard.note(str(r[1]), Style.INK))
|
|
|
|
|
var more := ModalCard.make_button("Fewer colours" if _more else "More colours…")
|
|
|
|
|
more.size_flags_horizontal = SIZE_SHRINK_BEGIN
|
|
|
|
|
more.pressed.connect(func() -> void:
|
|
|
|
|
_more = not _more
|
|
|
|
|
_rebuild.call_deferred())
|
|
|
|
|
_content.add_child(more)
|
|
|
|
|
|
|
|
|
|
|
Theme fonts: 13 bundled families and text/title pickers in the theme editor
Standard (Inter, Source Sans 3, Lora, Rokkitt), easy to read (Atkinson
Hyperlegible, Lexend, Andika, OpenDyslexic) and themed title faces (Cinzel,
IM Fell English, Uncial Antiqua, Orbitron, Special Elite). All OFL except
Special Elite (Apache 2.0); licence files sit beside the fonts. FontCatalog
builds faces, synthesising missing bold/italic.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:16:39 -06:00
|
|
|
## Text and title font pickers, with a line drawn in each choice.
|
|
|
|
|
func _font_row() -> Control:
|
|
|
|
|
var box := VBoxContainer.new()
|
|
|
|
|
var row := HBoxContainer.new()
|
|
|
|
|
row.add_theme_constant_override("separation", 24)
|
|
|
|
|
box.add_child(row)
|
|
|
|
|
var sample := HBoxContainer.new()
|
|
|
|
|
sample.add_theme_constant_override("separation", 16)
|
|
|
|
|
box.add_child(sample)
|
|
|
|
|
var show := func() -> void:
|
|
|
|
|
for c in sample.get_children():
|
|
|
|
|
c.queue_free()
|
|
|
|
|
var b := FontCatalog.resolve(str(_work.get("font_body", "")), "body")
|
|
|
|
|
var d := FontCatalog.resolve(str(_work.get("font_display", "")), "display")
|
2026-11-11 14:47:45 -06:00
|
|
|
sample.add_child(Style.make_label("Morgan Fortuna", FontCatalog.face(d, 700, false, false), 20, Style.INK))
|
Theme fonts: 13 bundled families and text/title pickers in the theme editor
Standard (Inter, Source Sans 3, Lora, Rokkitt), easy to read (Atkinson
Hyperlegible, Lexend, Andika, OpenDyslexic) and themed title faces (Cinzel,
IM Fell English, Uncial Antiqua, Orbitron, Special Elite). All OFL except
Special Elite (Apache 2.0); licence files sit beside the fonts. FontCatalog
builds faces, synthesising missing bold/italic.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:16:39 -06:00
|
|
|
sample.add_child(Style.make_label("rolls 2d6 for 7: a quiet night.", FontCatalog.face(b, 400, false, false), 15, Style.INK))
|
|
|
|
|
for spec: Array in [["Text font", "font_body", "body"], ["Title font", "font_display", "display"]]:
|
|
|
|
|
var key: String = spec[1]
|
|
|
|
|
var ob := _choice(FontCatalog.options(spec[2]), key, FontCatalog.resolve(str(_work.get(key, "")), spec[2]))
|
|
|
|
|
ob.item_selected.connect(func(_i: int) -> void: show.call())
|
|
|
|
|
row.add_child(ModalCard.field(spec[0], ob))
|
|
|
|
|
show.call()
|
|
|
|
|
return box
|
|
|
|
|
|
|
|
|
|
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
## Options without `id` unless the theme has the files for it.
|
|
|
|
|
func _offered(options: Array, id: String, has_files: bool) -> Array:
|
|
|
|
|
return options.filter(func(o: Array) -> bool: return o[0] != id or has_files)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## One swatch per mascot colour role; untouched roles keep the file's colour.
|
|
|
|
|
func _mascot_colors() -> Control:
|
|
|
|
|
var box := VBoxContainer.new()
|
|
|
|
|
box.add_child(ModalCard.section("Mascot colours"))
|
|
|
|
|
var grid := GridContainer.new()
|
|
|
|
|
grid.columns = 6
|
|
|
|
|
grid.add_theme_constant_override("h_separation", 10)
|
|
|
|
|
box.add_child(grid)
|
|
|
|
|
var drawn := MascotArt.file_colors(MascotArt.source(_work))
|
|
|
|
|
var mine: Dictionary = _work.get("mascot_colors", {})
|
|
|
|
|
for role: String in MascotArt.ROLES:
|
|
|
|
|
if not drawn.has(role) and not mine.has(role):
|
|
|
|
|
continue
|
|
|
|
|
var start := Color.from_string(str(mine.get(role, drawn.get(role, "#000"))), Color.BLACK)
|
|
|
|
|
grid.add_child(FillEditor.swatch(start, func(c: Color) -> void:
|
|
|
|
|
var colors: Dictionary = _work.get_or_add("mascot_colors", {})
|
|
|
|
|
colors[role] = "#" + c.to_html(false)
|
|
|
|
|
_dirty = true))
|
|
|
|
|
grid.add_child(ModalCard.note(str(MascotArt.ROLE_LABELS.get(role, role)), Style.INK))
|
|
|
|
|
return box
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Where this theme's pictures and sounds go, with a button that opens it.
|
|
|
|
|
func _folder_row() -> Control:
|
|
|
|
|
var row := HBoxContainer.new()
|
|
|
|
|
row.add_theme_constant_override("separation", 12)
|
|
|
|
|
var path := ThemeAssets.folder(_work)
|
|
|
|
|
var text := ModalCard.note("Pictures and sounds for this theme go in its folder (see the Theme Art Guide).", Style.MUTED)
|
|
|
|
|
text.size_flags_horizontal = SIZE_EXPAND_FILL
|
|
|
|
|
text.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
row.add_child(text)
|
|
|
|
|
var open := ModalCard.make_button("Open folder")
|
|
|
|
|
open.pressed.connect(func() -> void:
|
|
|
|
|
DirAccess.make_dir_recursive_absolute(path)
|
|
|
|
|
OS.shell_open(ProjectSettings.globalize_path(path)))
|
|
|
|
|
row.add_child(open)
|
|
|
|
|
return row
|
|
|
|
|
|
|
|
|
|
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
func _color(tok: String) -> Color:
|
|
|
|
|
return Color.from_string(str((_work["colors"] as Dictionary).get(tok, "#000")), Color.BLACK)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _put(key: String, value: Variant) -> void:
|
|
|
|
|
_work[key] = value
|
|
|
|
|
_dirty = true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _choice(options: Array, key: String, fallback: String) -> OptionButton:
|
|
|
|
|
var ob := OptionButton.new()
|
|
|
|
|
ModalCard.style_popup(ob.get_popup())
|
|
|
|
|
for i in options.size():
|
|
|
|
|
ob.add_item(str(options[i][1]), i)
|
|
|
|
|
if options[i][0] == str(_work.get(key, fallback)):
|
|
|
|
|
ob.select(i)
|
|
|
|
|
ob.item_selected.connect(func(i: int) -> void: _put(key, options[i][0]))
|
|
|
|
|
return ob
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Saves (a built-in becomes a new set) and restyles the app with it.
|
|
|
|
|
func _use() -> void:
|
|
|
|
|
if not _dirty:
|
|
|
|
|
_apply(_work)
|
|
|
|
|
return
|
|
|
|
|
if bool(_work.get("builtin", false)):
|
|
|
|
|
_save_as_new()
|
|
|
|
|
return
|
|
|
|
|
_work["id"] = ThemeStore.save(_work)
|
|
|
|
|
_apply(_work)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _save_as_new() -> void:
|
|
|
|
|
var start := str(_work.get("name", "Theme")) + " (mine)"
|
|
|
|
|
add_child(ModalCard.ask_text("Save theme", "Name", start, "Save", func(name: String) -> void:
|
Theme tiers 1-2: theme folders, mascot recolour, background scene and tile, frame sets, picture threads, sounds; nine new built-in themes
- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame;
ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt
recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays
roll / card turn / thread / click / ambient with View > Sound levels.
- Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal:
generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs).
- Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:05:40 -06:00
|
|
|
# A built-in's pictures and sounds stay in its folder: name them in full.
|
|
|
|
|
var t := ThemeAssets.pin_paths(_work, ThemeAssets.folder(_work)) if bool(_work.get("builtin", false)) else _work.duplicate(true)
|
Theme system: runtime colour tokens, theme sets and a Theme dialog
Style's colours become static vars named by role (BG, PANEL, CARD, THREAD,
ACCENT, TRIM, GLOW…) instead of materials (felt, copper, brass), so a theme
can replace them. Stray hard-coded colours moved into tokens.
ThemeStore applies built-in sets (Tarot, the new default: jewel-purple
cloth with a shine; Felt, the old look) and the user's own sets from
user://themes/. Fills for the background and panels can be gradients; the
background pattern (dots, stars, none) and logo are per set. View ▾ →
Theme… edits a set; changes to a built-in save as a new set. Using a theme
reloads the UI and keeps the open spread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:10:16 -06:00
|
|
|
t["name"] = name
|
|
|
|
|
t.erase("id")
|
|
|
|
|
t.erase("builtin")
|
|
|
|
|
t["id"] = ThemeStore.save(t)
|
|
|
|
|
_apply(t)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _delete() -> void:
|
|
|
|
|
if bool(_work.get("builtin", false)):
|
|
|
|
|
m.toast("Built-in themes can't be deleted.")
|
|
|
|
|
return
|
|
|
|
|
var id := str(_work.get("id", ""))
|
|
|
|
|
add_child(ModalCard.confirm("Delete theme", "Delete “%s”? This can't be undone." % _work.get("name", ""), "Delete", func() -> void:
|
|
|
|
|
ThemeStore.delete(id)
|
|
|
|
|
_refresh_sets(ThemeStore.DEFAULT_ID), true))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _apply(t: Dictionary) -> void:
|
|
|
|
|
close()
|
|
|
|
|
ThemeStore.use(m, t)
|