theme.module
README.md
theme
Resolves the token table and hands the result to the engine's theme system.
Screens never write a colour or a size: they ask for a token. `Theme.t("paper")` is the resolved value;
`Theme.style("label.display", { fontSize = 20 })` is a resolved class with overrides laid on top, ready to be a
node's `style`. Both work without the engine (the test suite runs them), and the same resolved theme is what
`Theme.register()` gives the engine so that `classes` on a node and the default chrome agree with it.
local Theme = require("~.modules.theme")
Theme.t("state-pursuit") -- "#C8463C"
Theme.n("space-4") -- 16 (a number token; errors if it is not a number)
Theme.style(".paper", { padding = 8 }) -- { background = "#F6F1E4", padding = 8 }
Theme.state(state) -- the colour of an attention state ("clear", "pursuit", ...)
Theme.pigment(id) -- the colour of a pigment id, or the ink colour when unknown
Theme.register() -- engine: ui.registerTheme + ui.defineStyles (call once, in awake)
Theme.resolve(tokens, styles) -- the pure resolver: returns tokens, styles or nil, nil, error
The interface is documented in the header of init.luau; this file repeats it for the asset browser.