# 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//theme.gd`, `const DATA`), files in `res://themes//`. Code, not JSON, so exports need no include filter. Godot imports the files (SVG → texture, OGG → stream). - **User themes:** keys in `user://themes/.json` (as before); files in the folder `user://themes//`. - 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//…` 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 `` (or ``) 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.