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

Recipe: use multiple theme controllers

Use multiple controllers when independent areas need different modes, selections, storage, or lifecycles. Share one resolver when those areas use the same theme loaders and cache.

import {
  createThemeCatalog,
  createThemeController,
  createThemeResolver,
} from '@pierre/theming';
import { themes } from '@pierre/theming/themes';

const catalog = createThemeCatalog({
  themes,
  defaultLightThemeName: 'pierre-light',
  defaultDarkThemeName: 'pierre-dark',
});

const resolver = createThemeResolver();

export const workspaceTheme = createThemeController({
  catalog,
  resolver,
  storageKey: 'workspace-theme',
});

export const previewTheme = createThemeController({
  catalog,
  resolver,
  defaultMode: 'light',
  storageKey: 'preview-theme',
});

Subscribe each area to its own controller. Call destroy() on each controller when its area is removed. Use distinct storage keys when selections must remain independent.

Referenced from SKILL.md