The game's look
Colours, text, frames, buttons, named parts and UI sounds: how every screen looks, all in src/content/look/.
Everything about how the UI looks, sounds and behaves lives in one folder, src/content/look/. It styles every MUI part through the theme, so window code never needs to change, and you never edit src/core/ for it. Build your UI from MUI parts (Box, Typography, Button, Paper...) and they all follow it.
| File | What you edit there |
|---|---|
colors.ts | The palette: text, accent, good / warn / danger... |
text.ts | Font and text sizes, per Typography variant |
frames.ts | The frame pictures the other files share |
buttons.ts | Every Button, by colour and by variant |
parts.ts | Named looks: engine parts (choices, touch buttons...) and your own |
sounds.ts | UI sounds: move, click, tab, window open / close |
mui.ts | Default props (behaviour) and raw MUI theme options, merged last |
map.ts | Text and speech bubbles on the map: name labels, the "press A" prompt, bark() bubbles (font, size, colours, outline, padding, fade) |
glyphs.ts | How keys and controller buttons are named in prompts and on the controls screen, per controller kind, with colours for face buttons |
index.ts | Panels, tabs, dropdowns, bars, sliders, switches, scrollbars, window gap |
To see every part in every state at once, open the dev panel (` key) → Look → Open look gallery. It updates as you save.
Colours
colors.ts becomes the MUI palette. Changing one line recolours every part that uses it, plus every color="primary" or sx={{ color: 'text.secondary' }} in your windows.
// src/content/look/colors.ts
export const gold = '#f2d48a' // your own names, to import in the other look files
export default {
text: '#f0e6d2', // 'text.primary'
muted: '#b9ae9a', // 'text.secondary': hints, captions
disabled: '#7d766a', // 'text.disabled'
accent: gold, // 'primary': primary buttons, switches that are on, sliders, spinners
second: '#90caf9', // 'secondary'
good: '#81c784', warn: '#ffb74d', danger: '#ef5350', info: '#64b5f6',
divider: 'rgba(240, 230, 210, 0.16)',
background: '#0d1117', // 'background.default'
surface: '#1b2433', // 'background.paper': panels without a frame
} satisfies LookColors
Fonts
Put a font file (woff2, woff, ttf or otf) in src/content/fonts/ and name it in index.ts there. It ships with the game, so no internet is needed (check the font's licence allows that).
// src/content/fonts/index.ts
import pixel from './pixel.woff2'
import emoji from './NotoColorEmoji.ttf'
export default defineFonts({
pixel: { name: 'Pixel', file: pixel }, // a choice in Settings → Text → Font
emoji: { name: 'Emoji', file: emoji, use: 'fallback' }, // fills in letters the others lack
special: { name: 'Special', file: special, use: 'internal' }, // only where you name it
})
- The id (
pixel) is the font's CSS family name: use it anywhere a font is set, e.g.font: "pixel, sans-serif"inlook/text.ts,look/map.tsor a line style. - choice (the default): listed in Settings → Text → Font with its
name, after the choices inscenes.tstext.fonts. - fallback: never picked; it comes after every font, so a letter the other fonts lack still shows. An emoji font here makes symbols like 💾 show on every device, also in toasts and on the map.
- internal: loaded, but never a choice and never added anywhere: only where you name it, e.g.
<p style={{ fontFamily: 'special' }}>Rocket</p>. - No Font row in Settings at all:
playerPicksFont: falseinscenes.tstext. Everyone then gets the first font oftext.fonts, even a player who picked another one before. - A bold or italic file of the same font: give it
family: 'pixel'andweight: 'bold'(orstyle: 'italic'). Only the first file of a family is listed as a choice.
The font in use, for things that should change with it:
import { useFont } from '@/core/managers/fonts'
const icon = useFont() === 'pixel' ? pixelIcon : icon // React: updates when the player picks another
game.fonts.current() // the same outside React: 'game', 'sans', 'pixel'…
game.fonts.choices() // every choice: { id, name, family }
game.fonts.playerPicks() // false when scenes.ts hides the Font row
In your own windows use the palette names, not colour codes, so they follow the look: sx={{ color: 'warning.main', borderColor: 'divider' }}. A minigame that needs its own colours keeps them in its own file or inline.
Text
// src/content/look/text.ts
export default {
font: "'MyFont', sans-serif",
size: 15, // base size in px (default 14)
h6: { fontWeight: 700 }, // window and section titles
body2: { fontSize: 14 }, // most text in windows
caption: { opacity: 0.8 },
button: { textTransform: 'none' }, // the text on every Button
} satisfies LookText
The names are the MUI Typography variants (<Typography variant="body2">). Each takes plain CSS.
Boxes and frames
Each part is a box: a background (any CSS background), a text color and, for art, a 9-slice frame image. The frame's corners keep their size, its sides stretch or tile, and its middle fills the inside, so one picture fits a button or a full window.
// src/content/look/index.ts
export default defineLook({
colors, text, button, parts, sounds, mui,
panel: { image: panelImage, slice: 8, scale: 2, pixelated: true }, // every Paper
tabs: { tab: { selected: { image: buttonFocus, slice: 4 } }, indicator: 'none' },
})
| Frame option | Meaning |
|---|---|
slice | Pixels of the image that are frame: one number, or [top, right, bottom, left]. Default 16. |
scale | Edge size on screen = slice × scale px. Pixel art cut at 4px with scale: 3 draws 12px edges; high-res art cut at 96px with scale: 0.25 draws 24px edges. Default 1. |
sides | 'stretch' (default), 'round' (tile whole copies: use it for patterned edges), 'repeat', 'space'. |
pixelated | Sharp pixels when scaled (pixel art). Leave it off for high-res art, which then scales smoothly. |
panel is the base of every MUI Paper (windows, chat box, toasts, battle panels, dropdown lists); window and dialog override it for windows and the chat box only. The look sets styles only: to add something to a window or the chat box (a logo, a footer) or move their parts, use src/content/ui/Window.tsx and src/content/ui/TextDialog.tsx.
Every box also takes css: plain CSS properties, applied last, so they win over everything else the box sets (a frame squares the corners; css can round them again). A state's css is added to the normal one.
Parts that react also take focus, pressed, disabled and selected boxes, merged over the normal one. A state without its own frame image keeps the frame with a small effect, so it always shows: focus brighter, pressed darker, disabled grey. A selected part that is focused keeps its selected picture. Parts with their own focus look drop MUI's pulsing grey focus blob (the click ripple stays). Focus is what gamepad and keyboard players see, so give it a clear picture; it also shows on mouse hover.
Buttons
A button has a colour (color="error") and a variant (variant="contained", "outlined" or "text"). Its look is built in this order, each on top of the one before: all → all.<variant> → <colour> → <colour>.<variant>. What you write straight in a look goes to all three variants.
// src/content/look/buttons.ts
const plain: LookButton = { image: button, slice: 4, color: '#f0e6d2' }
export default {
all: {
focus: { image: buttonFocus, slice: 4, color: 'gold' },
pressed: { css: { transform: 'translateY(1px)' } },
},
primary: plain, // one style for all three variants
secondary: {
...plain, // shared by the three...
contained: { color: 'white' }, // ...then each variant can differ
text: { image: undefined, background: 'transparent' },
},
error: { image: buttonError, slice: 4 },
} satisfies LookButtons
Named parts
parts.ts holds looks with a name. The engine draws some itself (keep those names, change the looks); add your own next to them and the name works, and autocompletes, everywhere.
// src/content/look/parts.ts
export default {
choice: { image: button, slice: 4 }, // engine: event answer buttons
cover: { background: 'rgba(0, 0, 0, 0.5)' }, // engine: behind a modal window
// ...
fancy: { image: gold, slice: 4, focus: { color: 'white' } }, // yours
} satisfies LookParts
<Button variant="fancy">Buy</Button> // a Button: starts from buttons.ts `all`, no MUI variant styling
<Paper variant="fancy">...</Paper>
<Box sx={part('fancy')} /> // anything else (import { part } from '@/core/ui/part')
<Box sx={part('fancy', 'selected')} /> // one state drawn flat, when you pick the state yourself
| Engine part | Where |
|---|---|
choice | Event answer buttons |
titleButton | Title screen menu buttons |
cover, logCover | The dark layer behind a modal window / behind the event log |
sceneToolbar | The strip of the scene toolbar's buttons (Settings, Save, Back, Auto, Skip… all of them), wherever toolbar.place puts it |
sideImage | The frame around the speaker's face next to the text (side image): no background or border = only the face |
inset | The frame of the picture in the middle (inset()). Optional: without it the picture only gets a shadow |
nameTag | The speaker's name on the chat box (a character's color replaces its background; a character's chatBox can lay its own looks over the box, the name and the text: A chat box per character) |
chapterCard, chapterCardLabel, chapterCardTitle | The full-screen chapter card: its cover, the "Chapter 1" line, and the title (Chapters) |
lineText, narrationText | The chat box's text: a line someone says, and narration. Use solid colours (no rgba): the player's "Text box opacity" fades the box behind the text, and see-through text would let the scene show through the letters |
lineTextRead, narrationTextRead (optional) | Added on top of the two above for a line the player has read before (in any playthrough, the same lines Skip passes): another colour, a softer weight. Leave them out and read lines look like new ones. A custom TextDialog.tsx also gets read. |
touchButton, joystick, joystickKnob | On-screen touch controls and the ☰ menu button |
viewer, viewerDot | Close button, caption and variant dots over a full-screen picture |
UI sounds
sounds.ts names a sound from src/content/audio/ for each thing the UI does. The engine plays them by itself for every control, on all devices; leave a line out for silence. They use the SFX volume.
// src/content/look/sounds.ts
export default {
move: { id: 'sfx/blip', volume: 0.4 }, // focus moved (keyboard / gamepad)
hover: 'sfx/blip', // mouse moved onto a control
click: 'sfx/click', // button, menu row, dropdown
tab: 'sfx/click', // a tab was picked
toggle: 'sfx/click', // switch or checkbox
open: 'sfx/confirm', // a window opened
close: 'sfx/click', // a window closed
buy: 'sfx/confirm', // your own name
} satisfies LookSounds
One element can differ with the data-sound attribute. It works on any element, and on a parent it covers everything inside (a whole list, a whole window body).
<Button data-sound="buy">Buy</Button> // plays `buy` from sounds.ts instead of `click`
<Button data-sound="none">...</Button> // silent
<Stack data-sound="none">...</Stack> // every control inside is silent
| Value | Effect |
|---|---|
| not set | The default for what the control is: click, tab (a tab) or toggle (switch, checkbox, radio); move / hover when it is reached |
"none" | No UI sound at all for it: no click, move or hover |
"name" | Plays that line of sounds.ts when clicked. A name that is not in sounds.ts is silent. |
Use data-sound="none" whenever a button's onClick plays its own sound, or the player hears two at once. The shop's Buy / Sell and the Save button do this: they play a confirm sound only when the action worked.
<Button
data-sound="none"
onClick={() => {
if (game.shops.buy(shop, id) === 'ok') game.audio.sfx('sfx/confirm')
}}
>
Buy
</Button>
- What counts as a control: buttons, links, inputs, dropdowns and their rows, tabs, sliders, and anything with
role="button"or atabIndex. A plainBoxwith anonClickis silent: useButtonBase, or calluiSound()yourself. - Disabled controls are silent.
moveplays only when the player moved the focus (arrows, d-pad, stick, Tab). A window focusing its first button, or a mouse click, does not play it.hoveris for a real mouse only, never touch.- When several happen in the same moment (a click that closes a window) only one is heard: open, close, tab, toggle, click, move, hover, in that order. A
data-sound="name"beats them all. - From code:
uiSound('buy')(import { uiSound } from '@/core/ui/sounds') plays a line ofsounds.ts. - Continuing a line of dialogue is not a control, so it has no UI sound (characters have their own blip).
Behaviour and everything else
mui.ts is a raw MUI theme, merged last. Use defaultProps for how a part behaves everywhere, and styleOverrides for anything the look has no setting for.
// src/content/look/mui.ts
export default {
components: {
MuiButton: { defaultProps: { variant: 'outlined', size: 'large' } },
MuiButtonBase: { defaultProps: { disableRipple: true } }, // no click ripple anywhere
MuiTooltip: { styleOverrides: { tooltip: { fontSize: 14 } } },
},
} satisfies ThemeOptions
Pixel art or high-res
Both work; only the numbers change. slice is always in the image's own pixels, and the frame's thickness on screen is slice × scale CSS px.
- Pixel art: small image,
scale2 or more,pixelated: true. - High-res: draw the frame 2–4× bigger than it should look and set
scaleto 1/2–1/4 (e.g.slice: 96, scale: 0.25). Phones and many laptops have 2–3 screen pixels per CSS px, so the extra detail is used there instead of being blurred up. Leave outpixelated. - Keep frame images in
src/content/assets/ui/. The lite build only shrinks gallery pictures andbackgrounds/folders; a shrunk frame would no longer match itsslice.
Parts in index.ts
| Part | Styles |
|---|---|
panel | Every MUI Paper: windows, the chat box, toasts, battle panels, dropdown lists, alerts |
window, dialog | Windows / the event chat box only (over panel) |
iconButton | Round icon buttons, e.g. a window's ✕ |
tabs | bar (strip), tab (selected = open tab), indicator (CSS background or 'none') |
slider | height, rail, track (filled part; { background: 'transparent', css: { border: 'none' } } hides it), thumb + thumbSize |
progress | height, rail, bar (HP/XP bars, loading) |
switch | track, thumb, and on: { track, thumb } for the switched-on look |
input, menu, menuItem | A closed dropdown, the list it opens, one row of it |
chip, alert, avatar | Chips (the money counter, quest tags; states show on clickable ones), alert boxes, avatars |
- The frame takes space inside the box: a 12px edge pushes the content in 12px. Thin parts (bars, sliders) need a
heightthat leaves room for both edges. - A
sxon one element still wins over the look, so a one-off restyle stays possible. Don't set a fixed smallheighton a framed bar there. - Images go in
src/content/assets/ui/and are imported, so they are bundled and checked. The ones there are placeholders. - Remove a part to get the plain MUI look back.
scrollbar colours the browser's own scrollbars everywhere (width: 'auto', 'thin' or 'none'). Leave it out and they are still dark, never the white default.
windowGap is the empty space (px) kept around windows so the game shows at their edges. It follows the game screen's shorter side: min on screens up to smallScreen px, max from largeScreen px, in between it grows smoothly. Phones get min (32 by default, half of max); set it to 0 to let them use every pixel.