.style files
A .style file sits next to a .ui file with the same name and styles it with a subset of
CSS. It is optional.
.hud { position: absolute; left: 24px; bottom: 24px; display: flex; gap: 8px; }
.health { width: 240px; height: 16px; color: #c33; }
#inventoryNote:focus { border-color: #7cd4d1; }
Selectors
| Selector | Example |
|---|---|
| Class | .slot |
| Id | #inventoryNote |
| State on a class or id | .slot:hover, #name:focus, .empty:disabled |
| List | .a, .b { ... } |
Tag selectors (button { }), descendant and child combinators are not supported
(expected a class, id or state selector). Rules cascade by specificity (id over class,
state adds to it) and then by source order.
Properties
Layout
| Property | Values |
|---|---|
display |
flex (default), grid, none |
position |
relative (default), absolute |
top, right, bottom, left, inset |
Lengths. Used by position: absolute |
box-sizing |
content-box, border-box |
width, height, min-width, max-width, min-height, max-height |
Lengths |
margin, padding (and -top, -right, -bottom, -left) |
Lengths, 1-4 values. Padding can't be negative |
Flexbox
| Property | Values |
|---|---|
flex-direction |
row (default), row-reverse, column, column-reverse |
flex-wrap |
nowrap, wrap, wrap-reverse |
flex-grow, flex-shrink |
Numbers |
flex-basis |
Length |
flex |
none, auto, or grow / shrink / basis |
justify-content |
start, end, center, space-between, space-around, space-evenly (flex-start and flex-end also work) |
align-items, align-self |
start, end, center, stretch (align-self also auto) |
align-content |
As justify-content, plus stretch |
gap, row-gap, column-gap |
Lengths (gap takes 1 or 2) |
Grid
| Property | Values |
|---|---|
grid-template-columns, grid-template-rows |
Tracks: pixel lengths, fr units, auto; or none |
grid-column, grid-row |
auto, N, N / M, N / span K, span K (one-based, up to 256) |
Appearance
| Property | Values |
|---|---|
color |
Text color; also the fill of a progress bar |
background, background-color |
A color |
border |
<width> solid <color> |
border-width, border-color, border-radius |
Pixels / color |
font-family |
Inter (built in) or a quoted .ttf path under assets/ |
font-size |
Pixels, greater than 0 |
opacity |
0 to 1 |
transition |
<property> <time> where property is all, opacity, color, background, background-color or border-color, time like 120ms or 0.2s; or none |
Values
- Lengths: pixels (
24px), percentages (50%),0, andauto. A bare number such as24is invalid (only0may omit the unit). Grid tracks take pixels,frandauto, not percentages. - Colors:
#rgb,#rgba,#rrggbb,#rrggbbaa,white,black,transparent. - Comments:
/* ... */.
An invalid declaration is reported as invalid CSS declaration 'font-size' with its
position; while the game runs the previous styles stay in place.