WarUI

Light and dark theme switching at runtime

GRID-A25-F02P0baselinePlanned

WarGrid ships light and dark themes and can switch between them at runtime without re-rendering rows or losing state. A switch only changes token values, so scroll position, selection and edits are preserved.

Planned. This page shows the specification from issue #205. The live example, source for every framework and the API reference replace it when the feature ships.

Live example

A grid scrolled to row 200 with three selected rows and one open cell editor, in the light theme.

Expected behavior

Switching the theme recolors the grid in a single frame. Scroll offset, selection, the active editor and its value are all retained. A themechange event appears in the demo's event log.

Planned API surface

theme option ('light'|'dark')data-war-theme attributesetTheme() methodthemechange event

Acceptance criteria

  • setTheme('dark') changes only CSS custom property values and causes no DOM row re-creation (pending)
  • Scroll position, selection and editor state are identical before and after a switch (pending)
  • A data-war-theme attribute on an ancestor applies the theme to every descendant grid (pending)
  • The themechange event fires once per switch and includes the previous and next theme names (pending)
  • The dark theme meets WCAG AA contrast for all text and interactive states (pending)