Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1bbc545
docs: add theme system design spec
nakamoto-hiru Apr 23, 2026
6b64a3c
docs: add theme system implementation plan
nakamoto-hiru Apr 23, 2026
a161a5a
feat(theme): add theme registry with migration helpers
nakamoto-hiru Apr 23, 2026
26d91a7
feat(theme): extract default palettes to per-theme CSS files
nakamoto-hiru Apr 23, 2026
ec503b5
refactor(theme): move palette out of theme.css; keep shadows + avatar…
nakamoto-hiru Apr 23, 2026
710efdb
feat(theme): retarget dark variant to data-mode; import default theme…
nakamoto-hiru Apr 23, 2026
fd81d87
feat(theme): migrate settings-store to ThemeId with legacy value migr…
nakamoto-hiru Apr 23, 2026
904a476
feat(theme): rewrite pre-paint script for theme-id + data-mode + lega…
nakamoto-hiru Apr 23, 2026
b7b1357
feat(theme): replace color-scheme tabs with grouped theme Select
nakamoto-hiru Apr 23, 2026
b5a12c8
feat(theme): add AMOLED Dark theme
nakamoto-hiru Apr 23, 2026
f837c3f
feat(theme): add Catppuccin Latte theme
nakamoto-hiru Apr 23, 2026
eb297aa
feat(theme): add Catppuccin Mocha theme
nakamoto-hiru Apr 23, 2026
fcec3a5
feat(theme): add Tokyo Night Dark theme
nakamoto-hiru Apr 23, 2026
7bd9a4a
feat(theme): add Gruvbox Dark theme
nakamoto-hiru Apr 23, 2026
f25d257
feat(theme): add Nord Dark theme
nakamoto-hiru Apr 23, 2026
55457c7
feat(theme): add One Dark theme
nakamoto-hiru Apr 23, 2026
ef94a14
feat(theme): add GitHub Light theme
nakamoto-hiru Apr 23, 2026
d17df85
feat(theme): add GitHub Dark theme
nakamoto-hiru Apr 23, 2026
9f51906
feat(theme): add dev-mode registry consistency assertions
nakamoto-hiru Apr 23, 2026
807f90c
docs(theme): document theme system architecture and add-a-theme proce…
nakamoto-hiru Apr 23, 2026
c39f18c
fix(theme): migrate ds-demo to data-theme + data-mode attrs
nakamoto-hiru Apr 23, 2026
8b21f7f
docs(theme): align color-scheme notes and MODES maintenance comments
nakamoto-hiru Apr 23, 2026
2f04b02
fix(theme): improve bg-strong contrast for AMOLED/GitHub/Nord dark th…
nakamoto-hiru Apr 23, 2026
6e750ce
fix(theme): keep AMOLED bg-strong subtle for pure-black spirit
nakamoto-hiru Apr 23, 2026
37564b4
Merge pull request #7 from lngdao/hiru-themesystem
lngdao Apr 24, 2026
9a5561a
Merge remote-tracking branch 'upstream/develop' into develop
lngdao Apr 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions docs/design/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,71 @@ Color registrations in `index.css` `@theme` block:
- Syntax: `text-syntax-keyword`, `text-syntax-string`, `text-syntax-comment`, etc.
- Markdown: `text-markdown-heading`, `text-markdown-link`, etc.

## Theme System

OpenACP ships with a registry of named themes. A theme is a complete, fixed palette — users pick one from a dropdown in Settings → Appearance. There is no separate light/dark toggle; the mode is a property of the theme (e.g. "Catppuccin Latte" is the light one).

### Architecture

Two HTML attributes drive styling:

- `data-theme="<id>"` — selects the palette CSS block in `src/openacp/styles/themes/<id>.css`
- `data-mode="light" | "dark"` — derived from the theme's `mode` field; drives:
- Tailwind `dark:` variant (via `@custom-variant dark ([data-mode="dark"] &)`)
- Avatar-token fallbacks (`[data-mode="light"]` / `[data-mode="dark"]` blocks in `theme.css`)

Each per-theme CSS file declares its own `color-scheme: light | dark` inside the `[data-theme="<id>"]` block — so native widget rendering follows the active palette directly rather than going through `data-mode`.

### Token coverage

Each theme overrides three groups (~55 tokens):

- **Background** (5), **Foreground** (4), **Border** (5)
- **Semantic** (5 colors × 2 weights = 10)
- **Syntax** (~20)
- **Markdown** (~15)

Avatar tokens are **not** overridden per theme — they fall back to the shared `[data-mode]` block so agent/user colors stay consistent across theme changes.

Shadows, shadcn aliases, and radii are theme-independent and live in `theme.css` at `:root`.

### Registry (v1)

| ID | Display name | Mode |
| ------------------- | ------------------ | ----- |
| `default-light` | Default Light | light |
| `default-dark` | Default Dark | dark |
| `amoled-dark` | AMOLED Dark | dark |
| `catppuccin-latte` | Catppuccin Latte | light |
| `catppuccin-mocha` | Catppuccin Mocha | dark |
| `tokyo-night-dark` | Tokyo Night Dark | dark |
| `gruvbox-dark` | Gruvbox Dark | dark |
| `nord-dark` | Nord Dark | dark |
| `one-dark` | One Dark | dark |
| `github-light` | GitHub Light | light |
| `github-dark` | GitHub Dark | dark |

Registry source: `src/openacp/lib/themes.ts`.

### Adding a new theme

1. Create `src/openacp/styles/themes/<id>.css`. Start from a same-mode theme as a template. Put the source URL in the file's header comment.
2. Fill palette values from the upstream source. Cover Core + Syntax + Markdown. **Do not override avatar tokens.**
3. Add an entry to `THEMES` in `src/openacp/lib/themes.ts`.
4. Add an entry to the `MODES` lookup in the inline script in `index.html`.
5. Add an `@import` line to `src/openacp/styles/index.css` (alphabetical, after default themes).
6. Run `pnpm dev`, open `/ds-demo.html`, switch to the new theme, verify:
- Core UI renders correctly
- Code blocks have readable syntax highlighting
- Markdown (headings, links, code, quotes) matches theme mood
- Avatars remain consistent

Estimated time: ~15–20 minutes per theme.

### Dev-mode checks

On startup in development builds, `verifyThemeRegistry()` (in `themes.ts`) probes each theme's CSS block and verifies the `MODES` lookup table in `index.html` stays in sync with the registry. Warnings — not errors — appear in the console.

## shadcn/ui Components (`src/openacp/components/ui/`)

Installed via `npx shadcn add`. Config in `components.json` (new-york style, Phosphor icons).
Expand Down
Loading
Loading