# Themes

A theme is a fixed set of CSS variables. Swap it, and every component follows: colours, corners, heights, borders, shadows and grain.

## The shipped themes

Zest ships two themes, `zest-light` and `zest-dark`. Without `data-theme` the page follows the OS; `data-theme="zest-dark"` on `<html>` picks one. On any other element it themes that part of the page:

```html
<html data-theme="zest-dark"></html>
```

Don't use Tailwind's `dark:` variants: a theme carries its own mode, so a component styled with the theme's utilities is right in every theme. Try the themes with the theme menu in the top bar.

## Write your own

A theme of your own is one rule with the variables of the theme contract, after the import:

```css
[data-theme='acme'] {
	color-scheme: light;
	--color-base-100: #ffffff;
	--color-base-200: #f5f5f5;
	/* … every variable in the zest-light rule of theme.css */
}
```

The contract is `base-100`, `base-200`, `base-300` and `base-content`; `primary`, `secondary`, `accent`, `neutral`, `info`, `success`, `warning` and `error`, each with its `-content`; the corners `radius-selector`, `radius-field` and `radius-box`; the heights `size-selector` and `size-field`; `border`; `depth` (shadows); and `noise` (grain on filled buttons). [/llms/theme.txt](/llms/theme.txt) lists every variable with what it does.

The grain (`--noise: 1`) is an inline SVG image, so a page with a Content Security Policy needs `img-src data:`.

## Layers

Floating layers have names: `z-overlay` (40: dialogs, sheets and their backdrop), `z-popover` (50: popovers, menus, tooltips) and `z-toast` (60). Give something of the app's own that floats one of them, never a numbered `z-50`, and keep the app's own fixed layers (a sticky header) below 40.
