# Theme (@limerdev/zest) A theme is one CSS rule that sets `color-scheme` and the 28 variables below, and nothing else. Zest ships `zest-light` and `zest-dark`. `data-theme=""` on `` picks one (on any element, it themes that part of the page); without it the page follows the OS. Components and apps use the variables through the Tailwind utilities below, never as hard-coded colours, and never with `dark:` classes: a theme carries its own mode. ### Variables Surfaces, from the page (100) to recessed areas (300), and the text on them. - `--color-base-100`: zest-light `#f2f2f3`, zest-dark `#1a1d2b` - `--color-base-200`: zest-light `#e9e9ea`, zest-dark `#161926` - `--color-base-300`: zest-light `#dcdcdd`, zest-dark `#11131d` - `--color-base-content`: zest-light `#1d1f20`, zest-dark `#eef0f2` Roles; each -content colour is the text on it. - `--color-primary`: zest-light `#e79363`, zest-dark `#e79363` - `--color-primary-content`: zest-light `#1a1d2b`, zest-dark `#1a1d2b` - `--color-secondary`: zest-light `#dfe0e3`, zest-dark `#2a2f45` - `--color-secondary-content`: zest-light `#1d1f20`, zest-dark `#eef0f2` - `--color-accent`: zest-light `#3f6f9a`, zest-dark `#8fb6d9` - `--color-accent-content`: zest-light `#f2f2f3`, zest-dark `#1a1d2b` - `--color-neutral`: zest-light `#1d1f20`, zest-dark `#0b0d14` - `--color-neutral-content`: zest-light `#f2f2f3`, zest-dark `#eef0f2` - `--color-info`: zest-light `#3f6f9a`, zest-dark `#8fb6d9` - `--color-info-content`: zest-light `#f2f2f3`, zest-dark `#1a1d2b` - `--color-success`: zest-light `#3a7346`, zest-dark `#8cc79a` - `--color-success-content`: zest-light `#f2f2f3`, zest-dark `#1a1d2b` - `--color-warning`: zest-light `#8a5a00`, zest-dark `#f2c46b` - `--color-warning-content`: zest-light `#f2f2f3`, zest-dark `#1a1d2b` - `--color-error`: zest-light `#c92e3b`, zest-dark `#ea6a6a` - `--color-error-content`: zest-light `#f2f2f3`, zest-dark `#1a1d2b` Shape: corners of small controls (checkbox, badge), fields (button, input) and boxes (dialog, card); base sizes of controls and fields; border width; shadows on (1) or off (0); grain on filled buttons on (1) or off (0). - `--radius-selector`: zest-light `0.25rem`, zest-dark `0.25rem` - `--radius-field`: zest-light `0.4rem`, zest-dark `0.4rem` - `--radius-box`: zest-light `0.5rem`, zest-dark `0.5rem` - `--size-selector`: zest-light `0.25rem`, zest-dark `0.25rem` - `--size-field`: zest-light `0.225rem`, zest-dark `0.225rem` - `--border`: zest-light `1px`, zest-dark `1px` - `--depth`: zest-light `0`, zest-dark `0` - `--noise`: zest-light `0`, zest-dark `0` ### Utilities Tailwind utilities made from the variables. A colour works with every colour utility (`bg-`, `text-`, `border-`, `ring-`, `fill-` …), a size with every sizing utility (`h-`, `w-`, `size-`, `min-h-` …). - Colours: `bg-base-100`, `bg-base-200`, `bg-base-300`, `bg-base-content`, `bg-primary`, `bg-primary-content`, `bg-secondary`, `bg-secondary-content`, `bg-accent`, `bg-accent-content`, `bg-neutral`, `bg-neutral-content`, `bg-info`, `bg-info-content`, `bg-success`, `bg-success-content`, `bg-warning`, `bg-warning-content`, `bg-error`, `bg-error-content` - Corners: `rounded-selector`, `rounded-field`, `rounded-box` Derived from the theme, never set by one: - `bg-muted` (colours): `color-mix(in oklab, var(--color-base-content) 72%, var(--color-base-100))` - `bg-border` (colours): `color-mix(in oklab, var(--color-base-content) 18%, transparent)` - `bg-input` (colours): `color-mix(in oklab, var(--color-base-content) 26%, transparent)` - `bg-hover` (colours): `color-mix(in oklab, var(--color-base-content) 7%, transparent)` - `bg-link` (colours): `color-mix(in oklab, var(--color-primary) 55%, var(--color-base-content))` - `bg-ring` (colours): `color-mix(in oklab, var(--color-primary) 55%, var(--color-base-content))` - `bg-backdrop` (colours): `color-mix(in oklab, var(--color-neutral) 55%, transparent)` - `h-field` (sizes): `calc(var(--size-field) * 10)` - `h-field-sm` (sizes): `calc(var(--size-field) * 8.5)` - `h-field-lg` (sizes): `calc(var(--size-field) * 11.5)` - `h-selector` (sizes): `calc(var(--size-selector) * 4)` - `shadow-field` (shadows): `0 1px 2px 0 color-mix(in oklab, var(--color-neutral) calc(var(--depth) * 12%), transparent)` - `shadow-box` (shadows): `0 16px 32px -8px color-mix(in oklab, var(--color-neutral) 24%, transparent), 0 0 0 1px color-mix(in oklab, var(--color-neutral) 6%, transparent)` Other utilities: - `noise`: Grain on a filled surface when the theme sets --noise: 1. At 0 the tile has no size, so nothing is drawn; a theme without --noise counts as 0. - `z-overlay`, `z-popover`, `z-toast`: Layers, lowest first: a modal (Dialog, AlertDialog, Sheet) with its backdrop; floating content (popovers, menus, tooltips, selects), which can open inside a modal; toasts, which stay readable over both. An app's own fixed layers go below z-overlay, under 40. ### A theme of your own One rule with the same variables, after the import of `theme.css` (here with zest-light's values), then `data-theme="acme"`: ```css [data-theme='acme'] { color-scheme: light; --color-base-100: #f2f2f3; --color-base-200: #e9e9ea; --color-base-300: #dcdcdd; --color-base-content: #1d1f20; --color-primary: #e79363; --color-primary-content: #1a1d2b; --color-secondary: #dfe0e3; --color-secondary-content: #1d1f20; --color-accent: #3f6f9a; --color-accent-content: #f2f2f3; --color-neutral: #1d1f20; --color-neutral-content: #f2f2f3; --color-info: #3f6f9a; --color-info-content: #f2f2f3; --color-success: #3a7346; --color-success-content: #f2f2f3; --color-warning: #8a5a00; --color-warning-content: #f2f2f3; --color-error: #c92e3b; --color-error-content: #f2f2f3; --radius-selector: 0.25rem; --radius-field: 0.4rem; --radius-box: 0.5rem; --size-selector: 0.25rem; --size-field: 0.225rem; --border: 1px; --depth: 0; --noise: 0; } ```