# App themes

> data-app-theme and AppTheme: per-area product accents.

Every studio area can set its own accent without forking components.

## Canonical values

`APP_THEMES` in `packages/ui/context/app-theme-context.tsx` defines the allowed
values. `AppTheme` is the corresponding TypeScript union.

| Theme | Typical areas | Family | OKLCH hue |
| --- | --- | --- |
| `today` | Today | Coral | 42 |
| `weekplan` | Week plan | Aquamarine | 200 |
| `calendar` | Calendar | Red | 20 |
| `tasks` | Tasks, Billing, Logs, and the default platform brand | Violet | 276 |
| `notebook` | Notebook | Fuchsia | 336 |
| `activities` | Activities | Turquoise | 176 |
| `nutrition` | Nutrition | Amber | 86 |
| `finance` | Finance | Green | 147 |
| `health` | Health | Pink | 356 |
| `library` | Library | Blue | 246 |
| `pomodoro` | Pomodoro | Orange | 64 |
| `goals` | Goals | Gold | 110 |
| `agent` | Agent chat | Cyan | 220 |
| `projects` | Projects | Magenta | 316 |
| `tags` | Tags | Purple | 296 |

## How it is applied

1. The shell resolves the area from the path.
2. It supplies both `AppThemeProvider` and a matching `data-app-theme="…"`.
3. Components that use the official Astryx accent tokens inherit the tint.

```tsx
import { AppThemeProvider } from '@agata/ui/context/app-theme-context';

<AppThemeProvider theme="finance">
  <div data-app-theme="finance">{children}</div>
</AppThemeProvider>
```

Helpers: `useAppTheme`, `resolveAppTheme`, `isAppTheme`.

## CSS and portals

`packages/ui/styles/globals.css` owns palette values. Each `[data-app-theme]`
scope overrides official accent, overlay, and focus variables with light/dark
values. Do not copy the palette into features or add Agata token aliases.

Context carries theme identity; the DOM attribute applies CSS. They must agree.
Dialog, Sheet, AlertDialog, and popup Combobox can inherit context and accept
an explicit root `appTheme`. Popover content may need its own `data-app-theme`
wrapper; DropdownMenu accepts the attribute on its root. Selector and
MultiSelector retain the upstream field/context contract without an Agata
content-slot prop.

## Transactional email

Transactional email HTML is outside the app token runtime. Its brand color and
sender name belong to the email owners:
`apps/api/internal/adapters/email/chrome.go` and
`apps/app/shared/lib/server/resend-email.ts`.

## Good practice

- Keep one active theme per primary view and one accent per control.
- Finance (147) and Library (246) are fixed palette anchors. Review changes
  against the whole palette and both color schemes; avoid feature-local hues.
- Composite views keep their primary theme while source rows or controls may
  scope their own domain theme. Grouping a source under Calendar does not
  change its origin color.
- Keep primary chrome neutral. Use accent in actions, tint, selection, focus,
  and small indicators instead of page background fills.
- Marketing may use scoped app-theme indicators to identify connected apps.
