TableTower/docs/THEMES.md
RobinFiredrake 61a548902f 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

4.3 KiB
Raw Permalink Blame History

Theme files (format spec)

A theme is a set of keys (colours, fonts, fills) plus optional art and sound files. Plain-language art rules for the user live in the "Theme Art Guide" doc; this page is the technical contract.

Where files live

  • Built-in themes: keys in GDScript (themes/<id>/theme.gd, const DATA), files in res://themes/<id>/. Code, not JSON, so exports need no include filter. Godot imports the files (SVG → texture, OGG → stream).
  • User themes: keys in user://themes/<id>.json (as before); files in the folder user://themes/<id>/.
  • A file path in a theme is relative to that folder, or a full res:// / user:// path. A user copy of a built-in theme keeps full res://themes/<id>/… paths, so it needs no copied files.
  • Mascot SVGs must be imported with the Keep File importer (importer="keep"): the app reads their text to swap colours, so the source file has to be in the export.

Keys (all optional; existing keys unchanged)

"logo": "fortune_teller" | "mascot" | "tower" | "none"
"mascot": "mascot.svg"                       # used when logo = "mascot"
"mascot_colors": {"outline": "#hex", "cloth": …, "trim": …, "eye": …, "eye_glint": …, "inner_line": …}
"background_scene": {"file": "background_scene.svg", "anchor": "bottom" | "center" | "top"}
"background_tile":  {"file": "background_tile.svg", "opacity": 0.6, "scale": 1.0}
"card_frame": "ornate" | "plain" | "art"     # "art" = the theme's own frame set below
"frame": {
  "corner": "frame_corner.svg", "corner_fixed": "frame_corner_fixed.svg",
  "edge": "frame_edge.svg",
  "corner_size": [W, H], "edge_size": [W, H],
  "side_mid": x, "top_mid": y, "edge_mid": x,
  "scale": 0.28, "outset": 9, "pad": 5,
  "lo": 0.05, "mid": 0.5, "highlight": 0.45
}
"thread": {"strip": "thread_strip.svg", "strip_size": [L, H], "width": 10,
           "pin": "thread_pin.svg", "pin_size": 14, "lo": 0.05, "mid": 0.5, "highlight": 0.45}
"sounds": {"roll": "sounds/roll.ogg", "card_turn": "sounds/card_turn.ogg",
           "thread": "…", "click": "…", "ambient": "…"}

Mascot colour roles

SVG <path> (or <g>) elements whose id is a role name get that role's colour as fill. Morgan's roles: outline, cloth, trim, eye, eye_glint, inner_line. Unknown ids keep their colour. A role with no colour in the theme keeps the colour drawn in the file.

Background

Drawn in screen space, back to front: flat BG → background fill → scene → tile (or the old pattern when there is no tile). The scene covers the view (scaled to cover, kept at its aspect), pinned by anchor. The tile repeats at scale, drawn at opacity. Both use fixed colours.

Gradient map (frames and thread strips)

The art is greyscale. Each pixel's lightness l picks a colour; alpha is kept:

  • l <= lo → dark (frames: BG_DEEP; threads: THREAD_DARK, or the thread's own colour darkened)
  • l = mid → trim (frames: the card's colour, else TRIM; threads: own colour, else THREAD)
  • l = 1 → trim lightened by highlight The built-in beaded frame uses mid = 0.30 so it looks as before.

Frame set geometry (source units, before scale)

  • corner: the top-left corner. The app mirrors it for the other three.
  • The frame's band leaves the corner downwards along the vertical line x = side_mid (at the corner's bottom edge) and rightwards along y = top_mid (at its right edge).
  • edge: one vertical tile of the band, edge_size = [W, H], its centre line at x = edge_mid. It repeats down the sides (stretched a little so whole tiles fit) and is turned −90° for the top and bottom, so it must look right both ways.
  • The frame is drawn around the card rectangle grown by outset px; pad is extra inner margin.
  • corner_fixed: optional overlay drawn on each corner in its own colours (nails, gems, pins).

Thread strip

One horizontal tile strip_size = [L, H], repeated along the thread's curve; drawn width px thick. Greyscale, gradient-mapped (above). Lit threads use ACCENT as the trim colour. pin (fixed colours) is drawn at both ends, pin_size px across.

Sounds

OGG Vorbis, mono, 44.1 kHz. roll: a roll starts. card_turn: a Deck mode result is revealed. thread: a roll travels along a thread. click: a button is pressed. ambient: loops while the theme is on. Volume and mute are app settings, not theme keys.