# Changing the look of the built-in screens

Every built-in screen (title, message window, choices, save, ending name, and so on) can change its look in the four tiers below. If an upper tier is enough, you do not need the lower ones.

1. **Text**: replace the fixed wording on a screen with the game's text table. The keys are the nested paths of `TEXT` in `packages/screens/src/strings.ts` (such as `"ending.mark"`). Write them in a plugin's `texts` or in the `ui` of a translation file (`lang/<language>.json`) (see "Changing the wording of the built-in screens" in [plugins.md](plugins.md) and the multilingual part of chapter 10 in [format.md](design/format.md))
2. **Theme values**: values in the `ui` of `liminalia.json` and of a theme's `themes/<id>/theme.json` (the shape is `UiConfig` in `@liminalia/lang`; see "Game settings" and "Themes" in [player.md](player.md)). Choosing a theme swaps these values together
3. **CSS**: override the classes and the CSS variables such as `--lm-*` in the game's CSS. The engine's CSS sits in the cascade layer `liminalia`, so the game's CSS wins without fighting over selector specificity.
   List the game's CSS in `ui.css` in `liminalia.json` (it's loaded after the theme and plugin CSS; "Project CSS" in [player.md](player.md)). In Liminalia Studio's "Game screens", you can click a part and write lines one at a time from fields
4. **Your own screen**: pass a function that builds an element to a plugin's `screens.*` and so on, and build the whole screen yourself (see "Replacing only the look of the standard screens" in [plugins.md](plugins.md)). The system handles opening, closing, blocking input and telling the recorder what can be chosen; the function drives the screen by calling the `api` it receives

The table lists what each screen can change in the four tiers. "—" means the screen does not have that tier; the reasons follow the table. The table is generated from `packages/web/src/system/screen-catalog.ts` (`npx tsx packages/web/scripts/screen-catalog.ts`), and a test checks it against the source (adding a screen, a text group, a theme value group or a replacement hook without listing it fails the test).
The parts table after it maps each screen's parts (selectors) to the theme values and CSS variables that set their look; it is what the panel shows when you click a part in the preview on the "Game screens" screen of Liminalia Studio (see [studio.md](studio.md)).
The tests check that each value is in `ui` in `liminalia.json`, that `ui-style.ts` puts the value into the listed variable, that the CSS of the part or its screen reads the variable, and that the parts appear on the sample screens.
The same list and parts tables can also be read with `lim shot --screens --json` and the MCP tool `list_screens`. `lim shot --screen <screen>` (the MCP tool `screen_shot`) opens a screen in the same sample with sample content and captures it (see "Changing a built-in screen and checking it" in [mcp.md](mcp.md)).

<!-- screen-catalog:start -->
| Screen | 1 Text keys | 2 Theme values (ui) | 3 CSS classes and variables | 4 Replacement hook |
|---|---|---|---|---|
| Click to start | `gate`, `gateTouch` | — | `.lm-gate` | — |
| Opening sequence | — | `splash` | `.lm-splash`, `.lm-splash-screen`, `.lm-splash-logo-image`, `.lm-splash-block`, `.lm-splash-label`, `.lm-splash-text`, `.lm-splash-rule` | `splash`, `endSplash` |
| Content warning | `warning.*` | `contentWarning`, `system` | `.lm-warning`, `.lm-warning-panel`, `.lm-warning-text`, `.lm-warning-buttons`, shared variables | — |
| Title | `title.*` | `title.menu`, `title.background`, `title.logo`, `title.showName`, `system.titleBg`, `system.titleButtonBg`, `system.titleShadow` | `.lm-title`, `.lm-title-name`, `.lm-title-logo`, `.lm-title-menu`, `.lm-title-button`, `--lm-title-bg`, `--lm-title-button-bg`, `--lm-title-shadow`, `--lm-title-align`, `--lm-title-direction`, `--lm-title-gap`, `--lm-title-button-width`, shared variables | `title`, `system` |
| Message window and text | — | `message`, `text`, `fonts`, `face` | `.message`, `.text`, `.ch`, `.message-frame`, `--message-bg`, `--message-fg`, `--message-border`, `--message-radius`, `--message-image`, `--message-padding`, `--font`, `--text-size`, `--text-line`, `--text-shadow`, `--read-fg`, `--lm-reveal-animation`, `--lm-reveal-time`, `--lm-reveal-easing` | `extensions.text`, `extensions.dialogue` |
| Name box | — | `name` | `.name`, `.lm-name-custom`, `--name-fg`, `--name-bg`, `--name-size`, `--name-border`, `--name-image`, `--name-font`, `--name-padding`, `--name-rule` | `screens.name` |
| Click-wait icon | — | `glyph` | `.glyph`, `.glyph-shape`, `--glyph-fg`, `--glyph-size`, `--glyph-gap` | `extensions.text.glyph` |
| Choices | `choice.*` | `choice` | `.choices`, `.choice-image`, `.choice-area`, `.choice-timer`, `.is-locked`, `.is-read`, `.lm-choices-custom`, `--choice-width`, `--choice-size`, `--choice-gap`, `--choice-fg`, `--choice-bg`, `--choice-hover-bg`, `--choice-border`, `--choice-image`, `--choice-radius`, `--choice-font` | `screens.choice` |
| Quick menu | `menu.*` | `menuBar` | `.lm-menubar`, `--lm-bar-fg`, `--lm-bar-shadow`, `--lm-bar-image`, `--lm-bar-active-image` | `screens.menuBar` |
| Auto and skip indicator | `menu.auto`, `menu.skip` | `indicator`, `menuBar.color`, `menuBar.shadow` | `.lm-indicator`, `.lm-indicator-mark`, `.lm-indicator-at-top-left`, shared variables | `screens.indicator` |
| Menu | `menu.*` | `system` | `.lm-menu`, `.lm-menu-panel`, `.lm-menu-list`, shared variables | `screens.menu` |
| Save and load | `saveload.*`, `saves.*` | `system`, `saveSlots`, `chapterNames` | `.lm-saveload`, `.lm-slots`, `.lm-slot-thumb`, `.lm-slot-name`, `.lm-slot-text`, `.lm-slot-date`, `.lm-slot-tools`, `--lm-thumb-bg`, shared variables | `screens.saveload` |
| Settings | `config.*`, `saves.*` | `system`, `system.images.sliderThumb`, `defaults`, `settings`, `message.background` | `.lm-config`, `.lm-config-row`, `.lm-config-label`, `.lm-config-control`, `.lm-config-value`, `.lm-preview`, `--lm-slider-thumb`, shared variables | `screens.config` |
| Backlog | `backlog.*` | `system`, `backlog`, `backlogChoices` | `.lm-backlog`, `.lm-log`, `.lm-log-name`, `.lm-log-text`, `.lm-log-search`, `--lm-speaker-fg`, `--lm-speaker-font`, shared variables | `screens.backlog` |
| Confirmation | `confirm.*`, `analytics.*`, `crash.*`, `update.*`, `quitUnavailable` | `system`, `system.images.frame` | `.lm-dialog-backdrop`, `.lm-dialog`, `.lm-dialog-message`, `.lm-dialog-buttons`, `--lm-frame-bg`, `--lm-frame-border`, `--lm-backdrop`, shared variables | `screens.confirm` |
| Ending name | `ending.*` | `ending`, `system.titleBg`, `system.fg`, `system.accent` | `.lm-ending`, `.lm-ending-go`, `.lm-ending-kind`, `.lm-ending-name`, `.lm-ending-rule`, `.lm-ending-mark`, `.lm-ending-mark-above`, `.lm-ending-mark-none`, `--lm-ending-bg`, `--lm-ending-image`, `--lm-ending-font`, `--lm-ending-fg`, `--lm-ending-size`, `--lm-ending-letter-spacing`, `--lm-ending-kind-fg`, `--lm-ending-rule`, `--lm-ending-mark-fg`, `--lm-ending-mark-size` | `screens.ending` |
| Extras | `extra.*` | `system` | `.lm-extra`, `.lm-extra-grid`, `.lm-extra-thumb`, `.lm-extra-viewer`, `.lm-extra-list`, `.lm-music`, shared variables | `screens.extra` |
| Flowchart | `flowchart.*` | `system` | `.lm-flow`, `.lm-flow-canvas`, `.lm-flow-summary`, `.lm-flow-ending`, shared variables | `screens.flowchart` |
| Controls help | `help.*` | `system`, `help` | `.lm-help`, `.lm-help-body`, `.lm-help-table`, `.lm-help-page`, shared variables | `screens.help` |
| Inventory | `items.*` | `system` | `.lm-items`, `.lm-items-grid`, `.lm-items-detail`, shared variables | `screens.items` |
| Dialog and text input (@dialog, @text-input) | `dialog.*` | `system.border`, `system.controlBg`, `system.fg`, `message.background`, `text.color`, `text.font` | `.lm-panel`, `.lm-panel-box`, `.lm-panel-buttons`, `.lm-panel-custom`, `.lm-keyboard`, `--lm-dialog-border`, `--lm-dialog-button-bg`, `--lm-dialog-button-fg` | `screens.dialog` |
| Notifications (@notify) | — | `system.screenBg`, `system.fg`, `system.accent`, `text.font` | `.lm-notices`, `.lm-notice`, `.lm-notice-title`, `--lm-notice-bg`, `--lm-notice-fg`, `--lm-notice-accent`, `--lm-notice-top`, `--lm-notice-right`, `--lm-notice-gap`, `--lm-notice-width` | `screens.toast` |
| Short messages (Saved, etc.) | `toast.*`, `store.*` | `system.screenBg`, `system.fg`, `system.border`, `system.radius` | `.lm-toast`, `--lm-toast-bg` | — |
| Glossary popup | `extra.termAdded` | `system` | `.lm-term-pop`, `.lm-term-name`, `.lm-term-desc`, `.lm-term`, shared variables | — |
| Sound captions | `captions.*` | `captions` | `.lm-caption` | — |
| Rotate-device hint | `rotate`, `rotateKeep` | — | `.lm-rotate` | — |
| Playtest feedback | `feedback.*` | — | `.lm-feedback` | — |
| Codex (@codex) | `codex.*` | `system` | `.lm-codex`, `.lm-codex-list`, `.lm-codex-item`, `.lm-codex-detail`, `.lm-codex-fresh`, `.lm-codex-related`, shared variables | `screens.codex` |
| Investigation (@investigate) | `investigate.*` | `system` | `.lm-investigate`, `.lm-investigate-spot`, `.lm-investigate-tip`, `.lm-investigate-finish`, `.lm-investigate-reveal`, `.lm-investigate-progress`, `.lm-investigate-opening`, shared variables | `extensions.renderers.investigate` |
| Map choice (@map-choice) | `mapChoice.*` | `system` | `.lm-map-choice`, `.lm-map-choice-spot`, `.lm-map-choice-panel`, `.lm-map-choice-locked`, `.lm-map-choice-go`, shared variables | `extensions.renderers.map-choice` |
| Chapter card and chapter end (@chapter-card, @chapter-end) | `chapter.*` | `chapter`, `system.titleBg`, `system.fg`, `system.accent` | `.lim-chapter`, `.lim-chapter-number`, `.lim-chapter-title`, `.lim-chapter-rule`, `.lim-chapter-subtitle`, `.lim-chapter-end`, `.lm-chapter-no-rule`, `--lim-chapter-bg`, `--lim-chapter-image`, `--lim-chapter-font`, `--lim-chapter-fg`, `--lim-chapter-size`, `--lim-chapter-letter-spacing`, `--lim-chapter-accent`, `--lim-chapter-number-size`, `--lim-chapter-subtitle-fg`, `--lim-chapter-subtitle-size`, `--lim-chapter-rule`, `--lim-chapter-end-fg`, `--lim-chapter-end-size` | `extensions.renderers.chapter-card`, `extensions.renderers.chapter-end` |
| Cut-in (@cutin) | — | — | `.lim-cutin-frame`, `.lim-cutin-image` | `extensions.renderers.cutin` |
| HUD (@hud) | — | `message.background`, `message.borderColor`, `text.color`, `text.shadow`, `text.size`, `text.font` | `.lim-hud`, `.lim-hud-button`, `.lim-hud-text`, `--message-bg`, `--message-fg`, `--message-border`, `--text-shadow` | `extensions.renderers.hud` |
| Chat screen (@chat-open, ui.chat.dialogue) | — | `chat` | `.lim-chat`, `.lim-chat-head`, `.lim-chat-list`, `.lim-chat-row`, `.lim-chat-bubble`, `.lim-chat-name`, `.lim-chat-note`, `--chat-bg`, `--chat-fg`, `--chat-other-bg`, `--chat-me-bg`, `--chat-radius`, `--chat-font` | `extensions.dialogue` |

Shared variables (filled from ui.system and read by every system screen):

`--lm-fg`, `--lm-fg-muted`, `--lm-accent`, `--lm-ui-font`, `--lm-text-font`, `--lm-screen-bg`, `--lm-control-bg`, `--lm-control-hover`, `--lm-control-active`, `--lm-border`, `--lm-border-faint`, `--lm-radius`, `--lm-screen-image`, `--lm-button-image`, `--lm-frame-image`

Text keys shared by every screen:

- `close`: Close buttons (every screen)
- `a11y`: Text handed to screen readers and text-to-speech

Tiers a screen does not have, and why:

- Click to start, theme values: A black layer that takes the first press so sound can play; it shows before the game's values are read
- Click to start, replacement: Not replaceable for the same reason; replace the opening sequence with splash
- Opening sequence, text: All text is written by the game in ui.splash
- Content warning, replacement: Not replaceable because it collects consent; change the text with ui.contentWarning
- Message window and text, text: The text comes from the script; the window has no fixed wording
- Name box, text: Names come from the script and cast.json
- Click-wait icon, text: A text icon is set with ui.glyph.text
- Notifications (@notify), text: The text comes from @notify and the game
- Short messages (Saved, etc.), replacement: A one-line message; the text table and CSS cover it. Use @notify and screens.toast for the game's own messages
- Glossary popup, replacement: A small popup on a word; CSS covers it. The glossary list is part of the extras (screens.extra)
- Sound captions, replacement: An accessibility aid that stays white on dark (CSS can still change it)
- Rotate-device hint, theme values: A device hint that does not follow the game's look
- Rotate-device hint, replacement: Not replaceable for the same reason
- Playtest feedback, theme values: A development tool shown only in playtest builds made with lim build --feedback
- Playtest feedback, replacement: Not replaceable for the same reason
- Cut-in (@cutin), text: An image-only effect with no wording
- Cut-in (@cutin), theme values: Its look comes from the image and the command's parameters
- HUD (@hud), text: The game writes the text and images in @hud
- Chat screen (@chat-open, ui.chat.dialogue), text: The text comes from the script and ui.chat.title

Screen parts and the theme values that set their look (the CSS variable each value goes into is in parentheses; a dash marks a part with no theme value, styled by overriding its selector in the game's CSS):

| Screen | Part | Selector | Theme values (ui) |
|---|---|---|---|
| Click to start | Click-to-start layer | `.lm-gate` | — |
| Opening sequence | Logo | `.lm-splash-logo-image` | `splash.logos` |
|  | Splash screen | `.lm-splash-screen` | `splash.notice.background`, `splash.notice.color` |
| Content warning | Warning text | `.lm-warning-text` | `contentWarning.text`, `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Screen background | `.lm-screen` | `system.screenBg` (`--lm-screen-bg`), `system.images.screen` (`--lm-screen-image`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Title | Game title | `.lm-title-name` | `system.titleShadow` (`--lm-title-shadow`), `system.fg` (`--lm-fg`) |
|  | Logo | `.lm-title-logo` | `title.logo` |
|  | Title buttons | `.lm-title-button` | `system.titleButtonBg` (`--lm-title-button-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Button layout | `.lm-title-menu` | `title.menu` |
|  | Title background | `.lm-title` | `title.background`, `system.titleBg` (`--lm-title-bg`) |
| Message window and text | Text | `.text` | `text.font` (`--font`), `text.size` (`--text-size`), `text.color` (`--message-fg`), `text.lineHeight` (`--text-line`), `text.letterSpacing` (`--text-letter-spacing`), `text.shadow` (`--text-shadow`), `text.readColor` (`--read-fg`) |
|  | Message window | `.message` | `message.background` (`--message-bg`), `message.borderColor` (`--message-border`), `message.radius` (`--message-radius`), `message.padding` (`--message-padding`), `message.image` (`--message-image`) |
| Name box | Name box | `.name` | `name.color` (`--name-fg`), `name.size` (`--name-size`), `name.font` (`--name-font`), `name.background` (`--name-bg`), `name.borderColor` (`--name-border`), `name.letterSpacing` (`--name-letter-spacing`), `name.shadow` (`--name-shadow`), `name.image` (`--name-image`), `name.rule` (`--name-rule`) |
| Click-wait icon | Click-wait icon | `.glyph` | `glyph.color` (`--glyph-fg`), `glyph.size` (`--glyph-size`), `glyph.gap` (`--glyph-gap`), `glyph.shape`, `glyph.text`, `glyph.image`, `glyph.motion` |
| Choices | Choice buttons | `.choices > button` | `choice.font` (`--choice-font`), `choice.size` (`--choice-size`), `choice.color` (`--choice-fg`), `choice.background` (`--choice-bg`), `choice.borderColor` (`--choice-border`), `choice.radius` (`--choice-radius`), `choice.letterSpacing` (`--choice-letter-spacing`), `choice.shadow` (`--choice-shadow`), `choice.image` (`--choice-image`) |
|  | Choice list | `.choices` | `choice.width` (`--choice-width`), `choice.gap` (`--choice-gap`), `choice.y` (`--choice-y`) |
| Quick menu | Quick menu | `.lm-menubar` | `menuBar.color` (`--lm-bar-fg`), `menuBar.shadow` (`--lm-bar-shadow`) |
| Auto and skip indicator | Auto and skip indicator | `.lm-indicator` | `menuBar.color` (`--lm-bar-fg`), `menuBar.shadow` (`--lm-bar-shadow`) |
| Menu | Heading | `.lm-screen-title` | `system.fg` (`--lm-fg`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Menu panel | `.lm-menu-panel` | `system.screenBg` (`--lm-screen-bg`), `system.images.frame` (`--lm-frame-image`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
|  | Backdrop | `.lm-menu` | — |
| Save and load | Slot number | `.lm-slot-name` | `system.accent` (`--lm-accent`) |
|  | Date | `.lm-slot-date` | `system.fg` (`--lm-fg-muted`) |
|  | Chapter name | `.lm-slot-chapter` | `chapterNames`, `system.fg` (`--lm-fg-muted`) |
|  | Text | `.lm-slot-text` | `system.fg` (`--lm-fg-muted`) |
|  | Memo | `.lm-slot-memo` | `system.accent` (`--lm-accent`) |
|  | Memo and lock buttons | `.lm-slot-tool` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border-faint`), `system.radius` (`--lm-radius`), `system.fg` (`--lm-fg-muted`) |
|  | Thumbnail | `.lm-slot-thumb` | `system.border` (`--lm-border-faint`) |
|  | Save slot | `.lm-slot` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border-faint`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`) |
|  | Slot grid | `.lm-slots` | `saveSlots` |
|  | Heading | `.lm-screen-title` | `system.fg` (`--lm-fg`) |
|  | Tabs | `.lm-tab` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Screen background | `.lm-screen` | `system.screenBg` (`--lm-screen-bg`), `system.images.screen` (`--lm-screen-image`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Settings | Item name | `.lm-config-label` | `system.fg` (`--lm-fg`) |
|  | Value | `.lm-config-value` | `system.fg` (`--lm-fg-muted`) |
|  | Slider | `.lm-range` | `system.images.sliderThumb` (`--lm-slider-thumb`), `system.accent` (`--lm-accent`) |
|  | Text preview | `.lm-preview` | `message.background` (`--message-bg`), `system.border` (`--lm-border`) |
|  | Toggle buttons | `.lm-toggle` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`) |
|  | Heading | `.lm-screen-title` | `system.fg` (`--lm-fg`) |
|  | Tabs | `.lm-tab` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Screen background | `.lm-screen` | `system.screenBg` (`--lm-screen-bg`), `system.images.screen` (`--lm-screen-image`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Backlog | Speaker | `.lm-log-name` | `system.accent` (`--lm-accent`) |
|  | Text | `.lm-log-text` | `system.fg` (`--lm-fg`) |
|  | Search box | `.lm-log-search` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
|  | Heading | `.lm-screen-title` | `system.fg` (`--lm-fg`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Screen background | `.lm-screen` | `system.screenBg` (`--lm-screen-bg`), `system.images.screen` (`--lm-screen-image`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Confirmation | Message | `.lm-dialog-message` | `system.fg` (`--lm-fg`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Dialog | `.lm-dialog` | `system.screenBg` (`--lm-screen-bg`), `system.images.frame` (`--lm-frame-image`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.font` (`--lm-ui-font`) |
|  | Backdrop | `.lm-dialog-backdrop` | — |
| Ending name | Kind | `.lm-ending-kind` | `ending.kindColor` (`--lm-ending-kind-fg`), `system.accent` (`--lm-accent`) |
|  | Ending name | `.lm-ending-name` | `ending.font` (`--lm-ending-font`), `ending.color` (`--lm-ending-fg`), `ending.size` (`--lm-ending-size`), `ending.letterSpacing` (`--lm-ending-letter-spacing`) |
|  | Divider | `.lm-ending-rule` | `ending.rule` (`--lm-ending-rule`), `system.accent` (`--lm-accent`) |
|  | End mark | `.lm-ending-mark` | `ending.mark`, `ending.markColor` (`--lm-ending-mark-fg`), `ending.markSize` (`--lm-ending-mark-size`) |
|  | Background | `.lm-ending` | `ending.background` (`--lm-ending-bg`), `ending.image` (`--lm-ending-image`), `system.titleBg` (`--lm-title-bg`) |
| Extras | CG thumbnail | `.lm-extra-thumb` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`) |
|  | Heading | `.lm-screen-title` | `system.fg` (`--lm-fg`) |
|  | Tabs | `.lm-tab` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Screen background | `.lm-screen` | `system.screenBg` (`--lm-screen-bg`), `system.images.screen` (`--lm-screen-image`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Flowchart | Progress | `.lm-flow-summary` | `system.fg` (`--lm-fg-muted`), `system.font` (`--lm-ui-font`) |
|  | Heading | `.lm-screen-title` | `system.fg` (`--lm-fg`) |
|  | Tabs | `.lm-tab` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Screen background | `.lm-screen` | `system.screenBg` (`--lm-screen-bg`), `system.images.screen` (`--lm-screen-image`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Controls help | Controls table | `.lm-help-table` | `system.border` (`--lm-border-faint`), `system.fg` (`--lm-fg-muted`) |
|  | Heading | `.lm-screen-title` | `system.fg` (`--lm-fg`) |
|  | Tabs | `.lm-tab` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Screen background | `.lm-screen` | `system.screenBg` (`--lm-screen-bg`), `system.images.screen` (`--lm-screen-image`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Inventory | Item | `.lm-items-tile` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`) |
|  | Name | `.lm-items-name` | `system.fg` (`--lm-fg`) |
|  | Description | `.lm-items-desc` | `system.fg` (`--lm-fg`) |
|  | Picture | `.lm-items-picture` | — |
|  | Heading | `.lm-screen-title` | `system.fg` (`--lm-fg`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Screen background | `.lm-screen` | `system.screenBg` (`--lm-screen-bg`), `system.images.screen` (`--lm-screen-image`), `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Dialog and text input (@dialog, @text-input) | Buttons | `.lm-panel-buttons` | `system.controlBg` (`--lm-dialog-button-bg`), `system.fg` (`--lm-dialog-button-fg`), `system.border` (`--lm-dialog-border`) |
|  | Dialog | `.lm-panel-box` | `message.background` (`--message-bg`), `system.border` (`--lm-dialog-border`), `text.font` (`--font`), `text.color` (`--message-fg`) |
| Notifications (@notify) | Notification | `.lm-notice` | `system.screenBg` (`--lm-notice-bg`), `system.fg` (`--lm-notice-fg`), `system.accent` (`--lm-notice-theme-accent`), `text.font` (`--font`) |
| Short messages (Saved, etc.) | Short message | `.lm-toast` | `system.screenBg` (`--lm-toast-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.fg` (`--lm-fg`) |
| Glossary popup | Term | `.lm-term-name` | `system.accent` (`--lm-accent`) |
|  | Glossary popup | `.lm-term-pop` | `system.screenBg` (`--lm-screen-bg`), `system.fg` (`--lm-fg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.font` (`--lm-ui-font`) |
|  | Term in the text | `.lm-term` | — |
| Sound captions | Caption | `.lm-caption` | — |
| Rotate-device hint | Rotate-device hint | `.lm-rotate` | — |
| Playtest feedback | Feedback form | `.lm-feedback` | — |
| Codex (@codex) | New badge | `.lm-codex-fresh` | `system.accent` (`--lm-accent`), `system.radius` (`--lm-radius`), `system.screenBg` (`--lm-screen-bg`) |
|  | Person on the chart | `.lm-codex-node` | `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.border` (`--lm-border`), `system.screenBg` (`--lm-screen-bg`) |
|  | List | `.lm-codex-list` | `system.border` (`--lm-border`) |
|  | Heading | `.lm-screen-title` | `system.fg` (`--lm-fg`) |
|  | Buttons | `.lm-button` | `system.controlBg` (`--lm-control-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`), `system.accent` (`--lm-accent`), `system.images.button` (`--lm-button-image`), `system.font` (`--lm-ui-font`) |
|  | Screen background | `.lm-codex` | `system.screenBg` (`--lm-screen-bg`), `system.images.screen` (`--lm-screen-image`), `system.fg` (`--lm-fg`) |
| Investigation (@investigate) | Spot name | `.lm-investigate-tip` | `system.screenBg` (`--lm-screen-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`) |
|  | Spot | `.lm-investigate-spot` | `system.radius` (`--lm-radius`), `system.fg` (`--lm-fg-muted`) |
|  | Investigation | `.lm-investigate` | `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Map choice (@map-choice) | Detail panel | `.lm-map-choice-panel` | `system.screenBg` (`--lm-screen-bg`), `system.border` (`--lm-border`), `system.radius` (`--lm-radius`) |
|  | Spot | `.lm-map-choice-spot` | `system.radius` (`--lm-radius`), `system.fg` (`--lm-fg`) |
|  | Map | `.lm-map-choice` | `system.fg` (`--lm-fg`), `system.font` (`--lm-ui-font`) |
| Chapter card and chapter end (@chapter-card, @chapter-end) | Chapter number | `.lim-chapter-number` | `chapter.accent` (`--lim-chapter-accent`), `chapter.numberSize` (`--lim-chapter-number-size`) |
|  | Chapter title | `.lim-chapter-title` | `chapter.size` (`--lim-chapter-size`), `chapter.letterSpacing` (`--lim-chapter-letter-spacing`), `chapter.color` (`--lim-chapter-fg`), `chapter.font` (`--lim-chapter-font`) |
|  | Divider | `.lim-chapter-rule` | `chapter.rule` (`--lim-chapter-rule`), `chapter.accent` (`--lim-chapter-accent`) |
|  | Subtitle | `.lim-chapter-subtitle` | `chapter.subtitleColor` (`--lim-chapter-subtitle-fg`), `chapter.subtitleSize` (`--lim-chapter-subtitle-size`) |
|  | Background | `.lim-chapter` | `chapter.background` (`--lim-chapter-bg`), `chapter.image` (`--lim-chapter-image`), `system.titleBg` (`--lm-title-bg`) |
| Cut-in (@cutin) | Cut-in | `.lim-cutin-frame` | — |
| HUD (@hud) | Buttons | `.lim-hud-button` | `message.background` (`--message-bg`), `message.borderColor` (`--message-border`), `text.color` (`--message-fg`), `text.size` (`--text-size`) |
|  | Text | `.lim-hud-text` | `text.color` (`--message-fg`), `text.font` (`--font`), `text.size` (`--text-size`), `text.shadow` (`--text-shadow`) |
| Chat screen (@chat-open, ui.chat.dialogue) | Name | `.lim-chat-name` | `chat.nameColor` (`--chat-name`) |
|  | Narration | `.lim-chat-note` | `chat.noteColor` (`--chat-note`) |
|  | Own bubble | `.lim-chat-row.is-me .lim-chat-bubble` | `chat.meBackground` (`--chat-me-bg`), `chat.meColor` (`--chat-me-fg`), `chat.radius` (`--chat-radius`), `chat.tailRadius` (`--chat-tail-radius`) |
|  | Other's bubble | `.lim-chat-bubble` | `chat.otherBackground` (`--chat-other-bg`), `chat.otherColor` (`--chat-other-fg`), `chat.radius` (`--chat-radius`), `chat.tailRadius` (`--chat-tail-radius`) |
|  | Header | `.lim-chat-head` | `chat.headBackground` (`--chat-head-bg`), `chat.headColor` (`--chat-head-fg`) |
|  | Chat screen | `.lim-chat` | `chat.background` (`--chat-bg`), `chat.image` (`--chat-image`), `chat.font` (`--chat-font`), `chat.size` (`--chat-size`), `chat.color` (`--chat-fg`) |
<!-- screen-catalog:end -->

## Changing a screen's structure with templates

The screens in the table below are written as HTML templates with attributes. Put the screen name and a template file in `ui.templates` in `liminalia.json`, and you can change in HTML what CSS cannot reach (order, nesting, extra text).

```json
{ "ui": { "templates": { "menu": "ui/screens/menu/menu.html", "choice": "ui/screens/choice/choice.html" } } }
```

- A template is a list of `<template data-part="part name" data-version="version">`. Copy the standard template (`packages/screens/src/<screen>.ts`) and edit it. Only the parts you write replace the standard ones, so you can replace just one choice or just one row of the controls table
- The engine gives elements with `data-role` their action, keys, gamepad, focus and sound. `data-field` and `data-attr-<attribute>` receive the screen's values, and `data-text` receives the standard wording. An element whose `data-if` value is empty is not shown
- The engine writes states as `data-lm-*` (`data-lm-focus`, `data-lm-disabled`, `data-lm-read`, `data-lm-current` and so on), so style them from CSS
- The menu shows the items in the order you write them. Items that cannot be used right now (such as quitting in the browser version) are removed by the engine even if you write them
- For choices, the frame (`screen`) and a single choice (`option`, `option-image` for pictures, `option-area` for an invisible area) can be replaced separately. The outermost element of `screen` stands for the choice layer (`.choices`) itself; its classes and attributes are put on the layer only while choices are shown
- For save and load, you can replace just one slot row (`slot`). Empty, locked and source slots get `data-lm-empty`, `data-lm-protected` and `data-lm-source`, and the tab of the current page gets `data-lm-current`
- For the backlog, you can replace just one page (`entry`). The element with `data-field="text"` receives the text with its ruby and colors. The search box is an input with `data-input="search"`; typing lists only the pages that match
- The title screen shows the items in the order you write them. "Continue" cannot be pressed while there are no saves, and items that cannot be used right now (such as quitting in the browser version) are removed by the engine even if you write them. The background, music and logo still come from `ui.title`
- On the settings screen, write `data-setting="setting name"` on each item's row (`bgm`, `skipUnread` and so on; a game's own setting is `custom.name`). Inside the row, an `<input>` becomes a slider, elements with `data-value` become choices, and an element with `data-toggle` becomes a switch, all tied to the setting's value. Remove a row to remove the item, and reorder rows to reorder items. Items that can't be used right now (desktop-only items and so on) are removed by the engine even if written. Tabs are buttons with `data-role="page"` and `data-page="name"`; pressing one shows only the elements whose `data-page` includes that name
- If a plugin's `screens.*` replaces the same screen, the plugin wins. The attribute rules and each part's values are in [design/screen-templates.md](design/screen-templates.md)

The table is generated from `packages/screens/src/` (with `npx tsx packages/web/scripts/screen-catalog.ts`, like the table above).

<!-- screen-templates:start -->
| Screen | Key in ui.templates | Parts (version) | Actions (data-role) | Values (data-field, data-if, data-attr-*) |
|---|---|---|---|---|
| Confirmation | `confirm` | `screen` 2 | `ok`, `cancel`, `close` | `message`, `yes`, `no`, `kind` |
| Menu | `menu` | `screen` 1, `screen-button` 1 | system action names (`SYSTEM_ACTIONS`), `close`, `open` | `auto`, `skip`, `label` |
| Controls help | `help` | `screen` 1, `tab` 1, `controls` 1, `row` 1, `page` 1 | `close`, `page` | `tabs`, `label`, `current`, `keyboard`, `touch`, `pad`, `title`, `image`, `text` |
| Ending name | `ending` | `screen` 1 | `proceed`, `close` | `name`, `kind`, `kind-label`, `mark`, `proceed`, `spoken` |
| Choices | `choice` | `screen` 1, `option` 1, `option-image` 1, `option-area` 1 | `choose` | `timer`, `text`, `image`, `index` |
| Save and load | `saveload` | `screen` 1, `page` 1, `banner` 1, `slot` 1, `memo` 1 | `close`, `page`, `cancel`, `pick`, `memo`, `protect`, `copy`, `move`, `delete` | `heading`, `label`, `current`, `spoken`, `message`, `name`, `date`, `chapter`, `time`, `sub`, `text`, `memo`, `thumb`, `locked`, `tools`, `protect`, `placeholder` |
| Backlog | `backlog` | `screen` 1, `entry` 1, `empty` 1 | `close`, `voice`, `jump` | `search-label`, `count`, `name`, `text`, `voice-label`, `jump-title` |
| Title | `title` | `screen` 1 | `start`, `load`, `extra`, `flowchart`, `config`, `help`, `exit` | `name`, `logo`, `heading` |
| Settings | `config` | `screen` 1, `option` 1, `speaker` 1, `binding` 1 | `close`, `page`, `reset`, `export`, `import`, `reset-controls`, `change` | `textSpeed`, `autoWait`, `windowOpacity`, `textScale`, `master`, `bgm`, `se`, `voice`, `filter-label`, `preview`, `controls`, `label`, `lang`, `volume`, `keys`, `waiting` |
<!-- screen-templates:end -->

## Examples

Change the ending-name screen with theme values (the `ui` of `theme.json` or `liminalia.json`). Anything you leave out keeps the system screen colors (`system.titleBg`, `fg`, `accent`) and the text font.

```json
"ending": { "background": "#0d0a08", "color": "#e9dcc0", "size": 56, "rule": "none", "mark": "above", "markColor": "#b08a4a" }
```

| Key | Meaning |
|---|---|
| `background`, `image` | The backdrop (CSS background) and a picture laid on it (from `bgimage`; cropped to fill the screen) |
| `font`, `color`, `size`, `letterSpacing` | Font, color, size (px; default 48) and letter spacing (default 0.16em) of the name |
| `kindColor` | Color of the kind label (BAD END and so on) shown above the name when `title=` is given |
| `rule` | Color of the rule between the name and the closing mark. `none` draws no rule |
| `mark`, `markColor`, `markSize` | Where the closing mark goes (`below`: under the name, the default; `above`: above the name; `none`: not shown), its color and its size (px; default 26) |

Change the closing mark's text ("The End") with the text key `ending.mark`, and the kind labels with `ending.kinds.<kind>` and `endingKinds` in `liminalia.json`. In CSS you can override `.lm-ending`, `.lm-ending-name`, `.lm-ending-rule`, `.lm-ending-mark` and so on (the game's CSS wins over the `ui.ending` values).

Chapter cards and chapter ends (`@chapter-card`, `@chapter-end`) are changed the same way with `ui.chapter`. Anything not set keeps the system screen colors and the text font.

```json
"chapter": { "background": "#0d0a08", "color": "#e9dcc0", "size": 60, "accent": "#b08a4a", "rule": "none", "endSize": 40 }
```

| Item | Contents |
|---|---|
| `background`, `image` | The backdrop (CSS background) and a picture laid on it (from `bgimage`, cropped to fill the screen; the command's `image=` is shown on top of it) |
| `font`, `color` | Font and text color |
| `size`, `letterSpacing` | Title size (px; 52 by default. The title of a chapter end is 8/13 of it, and the card title in a portrait game 10/13) and letter spacing (0.12em by default) |
| `accent`, `numberSize` | Color of the chapter number and the rule, and the number's size (px; 22 by default) |
| `subtitleColor`, `subtitleSize` | Subtitle color and size (px; 18 by default) |
| `rule` | Color of the rule between the title and the subtitle. `none` draws no rule |
| `endColor`, `endSize` | Color and size of the closing mark of a chapter end (px; 44 by default) |

Change the closing mark's text of a chapter end with the text key `chapter.end` or `text=` of `@chapter-end`. In CSS you can override `.lim-chapter`, `.lim-chapter-title`, `.lim-chapter-rule` and so on.

Make the choices your own screen (a plugin's `./web`):

```ts
export default defineWebPlugin({
  name: "cards",
  screens: {
    choice: (api) => {
      const row = document.createElement("div");
      row.className = "my-choices";
      for (const o of api.options) {
        const b = document.createElement("button");
        b.textContent = o.text;
        b.disabled = o.locked;
        b.onclick = () => api.choose(o.index);
        row.append(b);
      }
      return row;
    },
  },
});
```
