Skip to main content

Module theme

Module theme 

Source
Expand description

Themes: colour tokens, motion timing, typography roles and CSS-like style rules.

[meta]
name = "Nordic"
extends = "monochrome"

[colors]
accent = "#38BDF8"

[style."button.primary"]
bg = "$accent"
fg = "$ink"

[style."button:focus"]
bg = "pulse($accent, $accent-2)"

A theme only writes what differs from the theme it extends. Style rules match widget.variant:state selectors; more specific rules win, and at equal specificity the later rule wins, with rules of the extended theme counted first.

Structs§

Motion
Timing values from the theme’s [motion] table.
Resolved
The result of resolving a theme.
Selector
Which widgets, variants and states a style rule applies to.
StyleProps
Style properties after all matching rules have been layered.
Theme
A fully resolved theme, ready to style widgets.
ThemeRegistry
All themes known to an application: the built-in ones plus any loaded from disk.

Enums§

Paint
A resolved colour, possibly animated.
PropValue
The value of one style property.
State
An interaction state a style rule can target.

Constants§

REQUIRED_COLORS
Colour tokens every resolved theme defines.
SERIES_COLORS
How many categorical series tones a theme carries: series-1 to series-5.
WORD_PROPS
Style keys whose value is a word from a fixed list, as (widget, key, allowed words). Theme files are checked against this list; any other word is reported with its location.