Slice · AI prompt
ONE switcher: light/dark/system + ~30 color presets in one Popover. Registry ships inside the slice — no public/ setup.
# Install `theme-presets` — Theme Presets — unified switcher with bundled tweakcn registry
> ONE switcher: light/dark/system + ~30 color presets in one Popover. Registry ships inside the slice — no public/ setup.
📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail : https://resource.rahmanef.com/slices/theme-presets
🧠 JSON catalog : https://resource.rahmanef.com/api/knowledge?slice=theme-presets
🔗 Source : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/theme-presets
## 1. Install
```bash
npx rahman-resources add theme-presets
# alias: npx rr add theme-presets
```
The CLI copies `frontend/slices/theme-presets/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.
## 2. What it ships
- npm: `next-themes`, `lucide-react`
- shadcn primitives: `button`, `popover`
## 3. Wire it up
React/Next: `npx rr add theme-presets`, mount `<ThemeProviders>` or `<ThemePresetProvider>` inside next-themes and use `<ThemePresetSwitcher />`. SvelteKit: `npx rr add theme-presets --framework sveltekit`; mount `<ThemeProviders>` for preset + light/dark/system context, then `<ThemePresetSwitcher />`, optional `<ThemeColorSync />`, and `<SaveSiteDefaultButton onSave={...} />`. Both distributions share visitor > site > host default resolution, registry-data.json, CSS injection, grouping/swatches, preview/restore and agent tools. Tailwind 4 globals must map `--color-*` directly from runtime variables (see README/HOST-SETUP).
## Rules of engagement
- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice
The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.