Practical guide

Apply semantic interface styling

Request a validated theme contract and rely on semantic tokens instead of renderer-specific colors.

Procedure

  1. Choose a stable theme ID owned by the package or first-party interface.
  2. Set bounded text scale, high-contrast preference, and reduced-motion preference.
  3. Use registered semantic color roles for meaning rather than hardcoded renderer colors.
  4. Compose all controls after applying the theme for the current contribution.
  5. Handle error.invalid-theme by retaining the prior valid graph and correcting the contract.

Example

ui.set_theme({
    id = "worldforge.standard",
    text_scale = 1.0,
    high_contrast = false,
    reduced_motion = true
})

Constraints and recovery

Related symbols

Project references