UI.Theme
luastra/uiUI.Theme is a reusable record of optional screen color overrides. Direct UI.Screen color fields take precedence, while every omitted field inherits Luastra's built-in accessible palette.
Mental model
This is a declarative node: app.render describes it again from current state, while the host matches its stable id to the existing view.
Before you use it
Add luastra/ui to this module's dependencies in luastra.json, then import it with require("luastra/ui"). The project must declare the ui.render capability. app.render must return one UI.Screen root; place this node inside that tree rather than invoking it for a hidden side effect.
How it fits
This type exists during Luau analysis and documents values used by UI constructors or app.render. It is erased from the runtime bundle as a static type.
When to use it
Use UI.Theme to define one reusable palette and pass it to multiple UI.Screen roots. Override only the colors your product owns; omitted fields intentionally retain Luastra's accessible defaults.
Fields or definition
| Parameter | Type / values | Description |
|---|---|---|
| backgroundColor | string? | Default screen and inherited component background color. |
| textColor | string? | Default inherited foreground color for text-bearing components. |
| accentColor | string? | Accent color used by primary controls, outlines, and emphasis tokens. |
| mutedColor | string? | Checked mutedColor field of UI.Theme; its exact admitted type is string?. |
| surfaceColor | string? | Checked surfaceColor field of UI.Theme; its exact admitted type is string?. |
| successColor | string? | Checked successColor field of UI.Theme; its exact admitted type is string?. |
| warningColor | string? | Checked warningColor field of UI.Theme; its exact admitted type is string?. |
| dangerColor | string? | Checked dangerColor field of UI.Theme; its exact admitted type is string?. |
Children and layout
This component does not accept arbitrary child nodes; named parameters provide its content.
Accessibility and keyboard
A stable id, logical render-tree order, and visible labels preserve predictable keyboard and screen-reader navigation.
Common mistakes
- Using a duplicate id or an uppercase path segment.
- Passing a shared-group parameter that is not listed on this component page.
Returns
UI.Node — a declarative node in the new render tree.
What happens next
A checked annotation that matches the exact exported declaration.
Failures and fixes
If the annotation fails, compare the value with the exact declaration and the producing or consuming function.
Availability
Source API in 0.5.0-alpha; the public installer targets 0.5.0-alpha. Verify host-specific behavior against the selected SDK.
Exact declaration
export type Theme = {
backgroundColor: string?,
textColor: string?,
accentColor: string?,
mutedColor: string?,
surfaceColor: string?,
successColor: string?,
warningColor: string?,
dangerColor: string?,
}