style
The one place the screens of *First Light: Nearside* agree on colour, type and measure.
style
The one place the screens of First Light: Nearside agree on colour, type and measure.
local St = require("game.screens.style")
local m = St.metrics()
{ type = "label", props = { text = "XYLIDINE" }, style = St.caption(m) }
Measure
metrics() returns every length a screen tree needs, derived from the live
screen size — or from a size you hand it, which is how a layout is checked at a
shape the engine is not currently running at:
St.metrics({ w = 1920, h = 1080 })
Lengths come from unit, the smaller of the screen's short side and three
quarters of its height. A card is a column, so what limits it on a wide screen
is the height: 1080x1440 and 1920x1080 share a short side and have very
different room to stack in. Every size carries a cap, so type stops growing on
a large screen, and a floor, so words stay words on a phone held sideways.
Type
Four faces, each with a job: ArchivoBlack for the game's name, Anton for
headings and instrument labels, Arimo for prose, BerkeleyMono for anything
a player reads as a number. title / heading / caption / text /
readout return fresh style tables, so a caller may add to what it gets back.
fit(family, text, track, avail, cap) answers the largest size at which a line
still fits the width it has. It estimates from the face's average advance, so
it is there to shrink a line that would run past its box, never to choose a
size on its own — every call passes the size it wants as the cap.
Surface
panel(m) is the raised card and instrument tile: a lit top edge over a step
in lightness, then the shadow. well(m) is the recess every meter is filled
inside. row(m, focused) is a card row and the focus ring it wears when a pad
walks onto it. enter(delay, lift) and pulse(period, from, to) are the two
animations the screens use — an entrance that staggers across siblings, and a
slow breath for a live instrument.
Colours are NS.PALETTE plus the UI's own mixes of it; BAND maps each of the
four light bands to the colour every readout paints it in.
Scoped to this part · feeds back into the world's score.