theming

Use when an app uses @pierre/theming to list, resolve, select, switch, persist, or apply themes, including color modes, theme controllers, React state, UI colors, and bundled Pierre or Shiki collections.

Install
npx skills add 'https://github.com/pierrecomputer/pierre/tree/main/skills/theming'
Download bundle ↓
main · 1831817Scanned 2026-09-15

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗
View on GitHub
← Back to SKILL.md

Controller API

This reference covers controller and shared theme types from @pierre/theming.

Exports

ExportKindPurpose
createThemeControllerFunctionCreates state for a color mode and selected light and dark themes.
ThemeControllerTypeDefines controller state, mutations, subscription, and cleanup.
ThemeControllerOptionsTypeSelects a catalog or resolver and configures initial state.
ThemeControllerStateTypeDescribes the current selection and resolved theme.
PendingThemeResolutionTypeIdentifies the active theme load.
ThemeResolutionErrorTypeDescribes a failed active theme load.
ThemeResolutionErrorContextTypeIdentifies the name and scheme for a failed load callback.
ThemePersistenceTypeDefines custom load and save methods.
ThemeSelectionTypeDescribes the persisted mode and theme names.
ColorModeTypeAccepts light, dark, or system.
ColorSchemeTypeAccepts concrete light or dark.
ThemeLikeTypeDefines the shared resolved-theme shape.

ThemeControllerOptions fields

FieldPurpose
catalogSupplies descriptors and catalog default names.
resolverSupplies an existing resolver or shares one with other controllers.
defaultLightThemeNameOverrides the initial light theme name.
defaultDarkThemeNameOverrides the initial dark theme name.
defaultModeSets the initial color mode.
storageKeyStores the selection in browser local storage.
persistenceSupplies custom selection storage.
preloadInactiveResolves the inactive color-scheme theme too.
onResolutionErrorReceives an active theme load error.

Pass a catalog, a resolver, or a catalog with a shared resolver.

ThemeController members

MemberPurpose
resolverExposes the controller's resolver.
getState()Returns the current immutable state object.
setColorMode(mode)Selects light, dark, or system mode.
setThemeNameForScheme(scheme, name)Selects the theme for one color scheme.
subscribe(listener)Subscribes to state changes and returns an unsubscribe function.
destroy()Removes the system color-scheme listener.

ThemeControllerState fields

FieldPurpose
lightThemeNameStores the selected light theme name.
darkThemeNameStores the selected dark theme name.
modeStores the selected color mode.
resolvedColorSchemeProvides the active concrete light or dark scheme.
resolvedThemeProvides the active resolved theme object.
pendingThemeResolutionIdentifies an active theme load.
resolutionErrorDescribes the latest active load failure.
Referenced from SKILL.md