# Theme customization

Adapt Zenos through global and scoped overrides for colors, typography, shape, and elevation.

Make Zenos fit your product without rewriting its components. Theme customization changes shared visual decisions through CSS variables, while component props and local styles handle individual variations.

This guide explains **how to customize the system**. Browse [Colors](/foundations/colors/) for the color explorer and naming model, or [Dark mode](/foundations/dark-mode/) for theme selection, persistence, and system preferences.

## Understand the layers

<div className="zenos-token-layers not-content">
  <div>
    <span>Primitive</span>
    <strong>red-600</strong>
    <code>--color-red-600</code>
    <p>A reusable value with no product meaning.</p>
  </div>
  <span aria-hidden="true">→</span>
  <div>
    <span>Semantic</span>
    <strong>Brand border</strong>
    <code>--border-brand</code>
    <p>A role that adapts to the theme.</p>
  </div>
  <span aria-hidden="true">→</span>
  <div>
    <span>Component</span>
    <strong>Button</strong>
    <code>border-border-brand</code>
    <p>A component that consumes the role.</p>
  </div>
</div>

Primitive tokens describe values; semantic tokens describe purpose. Override the semantic role when you want to change its meaning across the application. Do not edit package source or copy component selectors into your theme.

For the complete foundation references, see [Colors](/foundations/colors/), [Fonts](/foundations/fonts/), [Typography](/foundations/typography/), [Radius](/foundations/radius/), and [Elevation](/foundations/elevation/). Structural spacing uses the typed [layout spacing scale](/foundations/spacing/), not the color naming model.

## Load styles before overrides

Put package imports at the top of your global `index.css`, before your application theme. For Tailwind CSS v4:

```css title="src/index.css"
@import "tailwindcss";
@import "@zentara-co/zenos-ui/tailwind.css";
@import "./styles/product-theme.css";
```

This entrypoint makes the tokens available as Tailwind utilities and to Tailwind CSS IntelliSense. Without Tailwind, replace the two package imports with `@import "@zentara-co/zenos-ui/styles.css";`. Load only your local `index.css` from the application entry; do not import both Zenos stylesheets.

Keep shared theme decisions in one application-owned stylesheet. Start with the roles your product needs; unspecified roles retain their Zenos values.

## Customize the application theme

The following examples use an explicit `data-theme="light"` or `data-theme="dark"` on the document root. Let your application's theme control manage that attribute; see [Dark mode](/foundations/dark-mode/) for the public `useTheme` hook and initialization guidance.

```css title="src/styles/product-theme.css"
:root[data-theme="light"] {
  --background-default: #ffffff;
  --background-neutral-card: #f1f5f9;
  --text-default: #0f172a;
  --text-subtle: #475569;
  --icon-default: #0f172a;
  --border-default: rgb(15 23 42 / 14%);
}

:root[data-theme="dark"] {
  --background-default: #10151a;
  --background-neutral-card: #1e293b;
  --text-default: #f1f5f9;
  --text-subtle: #cbd5e1;
  --icon-default: #f1f5f9;
  --border-default: rgb(241 245 249 / 16%);
}
```

Override related surfaces and foregrounds together, then check the resulting contrast. One brand variable does not recolor every component: different variants consume different emphasis and state roles. Use the [color explorer](/foundations/colors/) to identify the complete set you need.

Zenos also supports `.dark`. If your application uses classes instead of attributes, apply your overrides to the same convention. If you rely on CSS-only system preference without an explicit mode, include your custom dark values in a matching `prefers-color-scheme: dark` media query too; attribute-only overrides will not run without the attribute.

## Scope a product theme

Put overrides on a wrapper when a workspace, campaign, or embedded area needs a different visual treatment. Apply the application's active mode to that wrapper so its semantic values are selected explicitly.

```tsx
import { Button } from "@zentara-co/zenos-ui";

function CampaignActions() {
  return (
    <section data-product-theme="campaign" data-theme="light">
      <Button variant="primary">Create campaign</Button>
    </section>
  );
}
```

```css
[data-product-theme="campaign"][data-theme="light"] {
  --background-brand-subtle-default: #6d28d9;
  --background-brand-subtle-hover: #5b21b6;
  --background-brand-subtle-pressed: #4c1d95;
  --border-brand: #6d28d9;
  --text-brand: #6d28d9;
}

[data-product-theme="campaign"][data-theme="dark"] {
  --background-brand-subtle-default: #5b21b6;
  --background-brand-subtle-hover: #6d28d9;
  --background-brand-subtle-pressed: #7c3aed;
  --border-brand: #c4b5fd;
  --text-brand: #c4b5fd;
}
```

Descendants inherit the scoped variables. Explicit theme containers can define their own values, so place overrides on the boundary that owns the treatment rather than assuming they will cross every nested theme.

A nested light container does not cancel `dark:` utilities activated by a dark ancestor. Keep scoped brand treatments in the application's active mode unless you have verified mixed-mode styling for the affected components.

Portaled content outside the wrapper does not inherit its variables. For dialogs, popovers, and other overlays, apply the same theme boundary to the rendered content or use the component's supported portal-container option where available. Test triggers and overlays together.

## Customize typography and shape

Color is only one part of a theme. Font-family and radius variables can be overridden through the same cascade:

```css
:root {
  --font-heading: "Product Sans", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Product Sans", ui-sans-serif, system-ui, sans-serif;
  --font-code: "Product Mono", ui-monospace, monospace;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}
```

The product font names above are placeholders: load the actual font files in your application, as described in [Fonts](/foundations/fonts/). Zenos does not fetch them for you.

Preserve the hierarchy when adjusting scales. Larger radius roles should remain at least as large as smaller ones. When changing typography sizes, review line heights, label wrapping, and control density together; see [Typography](/foundations/typography/) and [Radius](/foundations/radius/) for the available roles.

## Customize elevation

Elevation combines a surface color with a shadow. Override the complete shadow value, not a shadow-color token when you intend to change its geometry:

```css
:root[data-theme="light"] {
  --elevation-shadow-overlay: 0 12px 24px rgb(15 23 42 / 16%), 0 0 0 1px rgb(15 23 42 / 8%);
}

:root[data-theme="dark"] {
  --elevation-shadow-overlay: 0 12px 24px rgb(0 0 0 / 40%), 0 0 0 1px rgb(241 245 249 / 12%);
}
```

Pair overlay shadows with `--elevation-surface-overlay-default`, and raised shadows with their corresponding raised surfaces. See [Elevation](/foundations/elevation/) for depth roles and their Tailwind utilities.

## Choose the right customization level

- **Component props:** Use `variant`, `size`, and other supported props for a component's existing visual treatments.
- **Theme variables:** Override shared decisions when the same change should affect every consumer of a role in a scope.
- **Local styles:** Use `className` or `style` for one-off composition, such as a specific card's width or spacing.
- **Application tokens:** Add a named product role when existing Zenos roles do not express its meaning.

Avoid deep selectors, private package imports, and assumptions about internal child order. If a local override repeats across features, consider moving the shared decision into the theme.

Semantic utilities and direct CSS variables consume the same roles:

```tsx
<section className="border border-border-default bg-background-neutral-card text-text-default">
  Workspace overview
</section>
```

```css
.workspace-panel {
  background: var(--background-neutral-card);
  color: var(--text-default);
  border: 1px solid var(--border-default);
}
```

## Add application-specific roles

Keep product concepts in application-owned variables. Reference a Zenos role when it already expresses the visual intent:

```css
[data-product-theme] {
  --risk-critical-surface: var(--background-danger-subtlest-default);
  --risk-critical-text: var(--text-danger-default);
}

.risk-banner {
  background: var(--risk-critical-surface);
  color: var(--risk-critical-text);
}
```

Define these aliases on the theme boundary where they are consumed so their references resolve against that boundary's semantic values. Document the purpose and owner of new roles. Only choose primitive values when a product role deliberately needs a treatment that differs from the existing semantic system.

## Validate your theme

- Check surfaces, text, icons, borders, and focus indicators together in both modes.
- Review default, hover, pressed, selected, disabled, invalid, and loading states.
- Test nested theme boundaries and portaled overlays, not just the page canvas.
- Check font loading, zoom, long labels, and responsive layouts after typography changes.
- Keep state understandable through labels, shapes, or icons as well as color.
- Verify contrast on the final rendered surface, especially for translucent values.

Use [Colors](/foundations/colors/) to inspect values, this guide to customize them, and [Dark mode](/foundations/dark-mode/) to manage how a mode is selected.

Source: https://zenos-ui.pages.dev/foundations/tokens/