> ## Documentation Index
> Fetch the complete documentation index at: https://www.beeq.design/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Theme

> This guide walks you through creating and applying a custom theme across your app or project.

To create a custom theme, override BEEQ's root semantics — the brand, intent, and neutral colors — with your own values. BEEQ's light and dark mode roles already point to those root tokens, so every component picks up your palette in both modes. Override individual mode roles only where your palette needs a different mapping.

> [!NOTE]
>
> Set `--bq-brand` and the other root semantics here, in the theme. To style UI with the brand color, use the mode role `--bq-ui--brand` instead, as described in [Color architecture](https://www.beeq.design/foundations/colors.md#color-architecture).

> [!NOTE]
>
> Namespace your theme using the `bq-theme` attribute (e.g., `bq-theme="my-custom-theme"`) or a matching CSS class (e.g., `.my-custom-theme`).

***

## Step-by-step guide

**1. Define root semantics**

Create a CSS file for your custom theme (e.g., `custom-theme.css`) and set the root tokens. Give each intent you change all five steps — see [Intent scale](https://www.beeq.design/foundations/colors.md#intent-scale) for what each step is used for:

```css theme={"theme":{"light":"one-light","dark":"night-owl"}}
[bq-theme="my-custom-theme"],
.my-custom-theme {
  /* Override font family */
  --bq-font-family: 'Inter', sans-serif;

  /* Brand: tint, fill, dark tint, and the two text-safe steps */
  --bq-brand-light:  var(--bq-purple-100);
  --bq-brand:        var(--bq-purple-600);
  --bq-brand-dark:   var(--bq-purple-1000);
  --bq-brand-strong: var(--bq-purple-600); /* text, icons, strokes on light surfaces */
  --bq-brand-bright: var(--bq-purple-300); /* text, icons, strokes on dark surfaces */

  /* Override the neutral scale if needed */
  --bq-neutral-50:  var(--bq-grey-50);
  --bq-neutral-100: var(--bq-grey-100);
  /* ... continue with other neutrals ... */

  /* Repeat the five steps for accent, info, success, warning, or danger
     to change them. Intents you don't set keep BEEQ's values. */
}
```

> [!TIP]
>
> Don't set `--bq-focus` here. Focus is a mode role that defaults to `--bq-brand-strong` in light mode and `--bq-brand-bright` in dark mode, so it follows your brand automatically.

**2. Adjust mode roles (optional)**

Override mode roles only where the defaults don't fit your palette. The most common cases are the on-color of a solid fill, the focus color, and neutral surfaces:

```css theme={"theme":{"light":"one-light","dark":"night-owl"}}
/* Light mode */
[bq-theme="my-custom-theme"]:not([bq-mode]),    /* Default — no mode specified */
[bq-theme="my-custom-theme"][bq-mode="light"],  /* Explicit light mode (via attributes) */
.my-custom-theme:not([bq-mode]),                /* Default — no mode (via CSS class) */
.my-custom-theme.light {                        /* Explicit light mode (via CSS classes) */
  --bq-text--on-brand: var(--bq-white);
  --bq-focus:          var(--bq-brand-strong);
}

/* Dark mode */
[bq-theme="my-custom-theme"][bq-mode="dark"],  /* Explicit dark mode (via attributes) */
.my-custom-theme.dark {                        /* Explicit dark mode (via CSS classes) */
  --bq-background--primary: var(--bq-neutral-1000);
  --bq-text--on-brand:      var(--bq-white);
  --bq-focus:               var(--bq-brand-bright);
}
```

The full list of mode roles and their defaults is in [Colors → Mode roles](https://www.beeq.design/foundations/colors.md#mode-roles). Hover and active colors aren't roles you set per component: BEEQ mixes them from the rest color with `--bq-hover` and `--bq-active`, so they follow your overrides.

**3. Apply your custom theme**

Include your custom theme CSS file in your project and set the `bq-theme` and `bq-mode` attributes on the `<html>` element.

> [!NOTE]
>
> `bq-mode` is optional for light mode: without it, the root element uses BEEQ's light mode roles plus the `:not([bq-mode])` overrides from the previous step. Set `bq-mode="dark"` (or the `.dark` class) to switch to dark mode.

> [!NOTE]
>
> Always load `beeq.css` **before** your custom theme CSS so that your variables correctly override the defaults.

Pick the setup that matches your project:

```html Plain HTML icon="html5" theme={"theme":{"light":"one-light","dark":"night-owl"}}
<!DOCTYPE html>
<html lang="en" bq-theme="my-custom-theme" bq-mode="light">
  <head>
    <link rel="stylesheet" href="path/to/beeq.css">
    <link rel="stylesheet" href="path/to/custom-theme.css">
  </head>
  <body>
    <!-- Your components will automatically use the custom theme -->
    <bq-button>Click me</bq-button>
  </body>
</html>
```

```css Bundler (React / Vue / Angular) icon="css" theme={"theme":{"light":"one-light","dark":"night-owl"}}
/* src/index.css — load BEEQ first, then your custom theme */
@import "@beeq/core/dist/beeq/beeq.css";
@import "./custom-theme.css";
```

```css Tailwind v4 icon="tailwind" theme={"theme":{"light":"one-light","dark":"night-owl"}}
/* src/index.css */
@layer theme, base, bq, components, utilities;
@import "tailwindcss";
@import "@beeq/core/dist/beeq/beeq.css";
@plugin "@beeq/tailwindcss";
@import "./custom-theme.css";
```

```ts Tailwind v3 icon="tailwind" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
// tailwind.config.ts
import beeqPreset from "@beeq/tailwindcss";
import type { Config } from "tailwindcss";

export default {
  content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx,vue}"],
  presets: [beeqPreset],
} satisfies Config;
```

The `@beeq/tailwindcss` preset maps BEEQ tokens to Tailwind utility classes but does not define your custom theme. Keep the custom theme CSS as a separate file that overrides `--bq-*` variables, and load it after `beeq.css`.

> [!NOTE]
>
> With Tailwind v4, `@beeq/tailwindcss` 1.16.2 and earlier fail with `@plugin` (`b is not a function`). On those versions, use `@config "@beeq/tailwindcss";` instead.

> [!WARNING]
>
> With Tailwind v4, name the `bq` layer before Tailwind's layers as shown. Without it, the BEEQ reset overrides Tailwind utilities such as `mx-auto`. See [Apps that use cascade layers](https://www.beeq.design/getting-started/installation.md#apps-that-use-cascade-layers).

Set the theme and mode on the root element from your app entry so the attributes are present before any component renders:

```tsx React icon="react" theme={"theme":{"light":"one-light","dark":"night-owl"}}
// src/main.tsx
document.documentElement.setAttribute("bq-theme", "my-custom-theme");
document.documentElement.setAttribute("bq-mode", "light");
```

```ts Angular icon="angular" theme={"theme":{"light":"one-light","dark":"night-owl"}}
// src/main.ts
document.documentElement.setAttribute("bq-theme", "my-custom-theme");
document.documentElement.setAttribute("bq-mode", "light");
```

```html Plain HTML icon="html5" theme={"theme":{"light":"one-light","dark":"night-owl"}}
<html lang="en" bq-theme="my-custom-theme" bq-mode="light">
```

To switch to dark mode, change the `bq-mode` attribute:

```html theme={"theme":{"light":"one-light","dark":"night-owl"}}
<html lang="en" bq-theme="my-custom-theme" bq-mode="dark">
```

You can also use CSS classes instead of HTML attributes:

```html theme={"theme":{"light":"one-light","dark":"night-owl"}}
<body class="my-custom-theme light"> ... </body>
<!-- or -->
<body class="my-custom-theme dark"> ... </body>
```

> [!TIP]
>
> For a full React setup — packages, styles, icons, and event handling — see the [React framework guide](https://www.beeq.design/guides/frameworks/react.md). For the Tailwind utility classes that BEEQ ships alongside your custom theme, see [Colors → Tailwind CSS](https://www.beeq.design/foundations/colors.md#tailwind-css).

***

## Full example: Nebula theme

**Nebula** pairs a fuchsia brand with a cyan accent on violet-tinted neutrals, and adds rounder corners and Space Grotesk type. It changes every component in three short layers:

1. **Root semantics.** Brand, accent and the neutral scale, plus the font and radius tokens. BEEQ's mode roles read from these, so light and dark mode follow on their own.
2. **Mode roles.** Four dark-mode overrides: solid brand and accent fills switch to their bright steps, with dark text on top.
3. **Component variables.** Two component-level choices: cards sit on the raised surface with a hairline border, and the progress bar uses the accent instead of the brand, on a cyan-tinted track in dark mode.

Nebula doesn't set info, success, warning or danger, so those keep BEEQ's values: the info alert stays blue while the brand turns fuchsia. Toggle the mode in the preview to compare both palettes.

```css styles.css icon="css" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap");

/* 1. Root semantics: palette, neutrals, type and shape */
[bq-theme="nebula"] {
  --bq-font-family: "Space Grotesk", sans-serif;

  --bq-brand-light:  #fae8ff;
  --bq-brand:        #c026d3;
  --bq-brand-dark:   #4a044e;
  --bq-brand-strong: #a21caf;
  --bq-brand-bright: #f0abfc;

  --bq-accent-light:  #cffafe;
  --bq-accent:        #0e7490;
  --bq-accent-dark:   #083344;
  --bq-accent-strong: #0e7490;
  --bq-accent-bright: #67e8f9;

  --bq-neutral-50:   #f7f6fb;
  --bq-neutral-100:  #efedf7;
  --bq-neutral-200:  #dedaee;
  --bq-neutral-300:  #c3bdd9;
  --bq-neutral-400:  #a29abf;
  --bq-neutral-500:  #7b729d;
  --bq-neutral-600:  #5d5580;
  --bq-neutral-700:  #463f66;
  --bq-neutral-800:  #2b2644;
  --bq-neutral-900:  #221d38;
  --bq-neutral-950:  #18142b;
  --bq-neutral-1000: #0e0b1c;

  --bq-radius--s: 0.75rem;
  --bq-radius--m: 1.25rem;
  --bq-radius--l: 2rem;
}

/* 2. Mode roles: dark fills use the bright steps, with dark text on top */
[bq-theme="nebula"][bq-mode="dark"] {
  --bq-ui--brand:       var(--bq-brand-bright);
  --bq-text--on-brand:  var(--bq-neutral-1000);
  --bq-ui--accent:      var(--bq-accent-bright);
  --bq-text--on-accent: var(--bq-neutral-1000);
}

/* 3. Component variables: raised, outlined cards and an accent progress bar,
   with a cyan-tinted track in dark mode */
[bq-theme="nebula"] bq-card {
  --bq-card--background:  var(--bq-ui--primary);
  --bq-card--borderColor: var(--bq-stroke--primary);
  --bq-card--borderWidth: var(--bq-stroke-s);
}

[bq-theme="nebula"] bq-progress {
  --bq-progress-bar--indicatorColor: var(--bq-ui--accent);
}

[bq-theme="nebula"][bq-mode="dark"] bq-progress {
  --bq-progress-bar--trackColor: color-mix(in srgb, var(--bq-ui--accent) 25%, var(--bq-ui--primary));
}

/* Demo layout */
body {
  margin: 0;
  padding: var(--bq-spacing-l);
  background-color: var(--bq-background--primary);
  color: var(--bq-text--primary);
  font-family: var(--bq-font-family);
}

.mission-card {
  --bq-card--padding: var(--bq-spacing-xl);

  max-inline-size: 36rem;
  margin-inline: auto;
}

/* Brand-to-accent bar and two top-corner glows. The glows peak at a 10% tint,
   so text on the card keeps its contrast in both modes. */
.mission-card::part(wrapper) {
  background-image:
    linear-gradient(90deg, var(--bq-ui--brand), var(--bq-ui--accent)),
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--bq-ui--brand) 10%, transparent), transparent 60%),
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--bq-ui--accent) 10%, transparent), transparent 60%);
  background-repeat: no-repeat;
  background-size: 100% var(--bq-spacing-xs), 100% 100%, 100% 100%;
  box-shadow: var(--bq-box-shadow--m);
}

.mission {
  display: flex;
  flex-direction: column;
  gap: var(--bq-spacing-l);
}

.mission__header,
.mission__tags,
.mission__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--bq-spacing-s);
}

.mission__title {
  flex: 1;
}

.mission__title h2,
.mission__title p {
  margin: 0;
}

.mission__title h2 {
  font-size: var(--bq-font-size--xl);
  font-weight: var(--bq-font-weight--bold);
}

.mission__title p {
  color: var(--bq-text--secondary);
}

.mission__meter {
  display: flex;
  flex-direction: column;
  gap: var(--bq-spacing-xs);
}

.mission__actions {
  justify-content: flex-end;
}
```

```html HTML icon="html5" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<!DOCTYPE html>
<html lang="en" bq-theme="nebula" bq-mode="light">
  <head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@beeq/core/dist/beeq/beeq.css">
    <link rel="stylesheet" href="styles.css">
    <script
      type="module"
      src="https://cdn.jsdelivr.net/npm/@beeq/core/dist/beeq/beeq.esm.js"
      data-beeq="https://cdn.jsdelivr.net/npm/@beeq/core/dist/beeq/svg/"
    ></script>
  </head>
  <body>
    <bq-card class="mission-card" border="l">
      <main class="mission">
        <header class="mission__header">
          <bq-avatar initials="OR" label="Orion crew" size="medium"></bq-avatar>
          <div class="mission__title">
            <h2>Orion launch window</h2>
            <p>Mission control · T-minus 42 min</p>
          </div>
          <bq-button id="mode-toggle" appearance="secondary" border="full" label="Switch to dark mode" only-icon size="small">
            <bq-icon id="mode-icon" name="moon"></bq-icon>
          </bq-button>
        </header>

        <bq-alert type="info" open disable-close>
          Info stays blue
          <span slot="body">Nebula sets only brand, accent and neutrals, so info, success, warning and danger keep BEEQ's values.</span>
        </bq-alert>

        <div class="mission__tags">
          <bq-tag color="success">Fuel nominal</bq-tag>
          <bq-tag color="warning">Crosswind 18 kn</bq-tag>
          <bq-tag color="info" variant="outline">Weather update</bq-tag>
        </div>

        <div class="mission__meter">
          <span>Fuel load</span>
          <bq-progress value="62" label></bq-progress>
        </div>

        <bq-input name="callsign" placeholder="e.g. Orion-7">
          <label slot="label">Callsign</label>
        </bq-input>

        <bq-switch name="autopilot" checked>Autopilot</bq-switch>

        <footer class="mission__actions">
          <bq-button appearance="text">Cancel</bq-button>
          <bq-button appearance="secondary">Save draft</bq-button>
          <bq-button>
            <bq-icon name="rocket-launch" slot="prefix"></bq-icon>
            Launch
          </bq-button>
        </footer>
      </main>
    </bq-card>

    <script>
      const root = document.documentElement;
      const toggle = document.querySelector("#mode-toggle");
      const icon = document.querySelector("#mode-icon");

      toggle.addEventListener("bqClick", () => {
        const isDark = root.getAttribute("bq-mode") === "dark";
        root.setAttribute("bq-mode", isDark ? "light" : "dark");
        icon.setAttribute("name", isDark ? "moon" : "sun");
        toggle.setAttribute("label", isDark ? "Switch to dark mode" : "Switch to light mode");
      });
    </script>
  </body>
</html>
```

```tsx React icon="react" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { useEffect, useState } from "react";
import { BqAlert, BqAvatar, BqButton, BqCard, BqIcon, BqInput, BqProgress, BqSwitch, BqTag } from "@beeq/react";
import "./styles.css";

export function NebulaDemo() {
  const [isDark, setIsDark] = useState(false);

  useEffect(() => {
    const root = document.documentElement;
    root.setAttribute("bq-theme", "nebula");
    root.setAttribute("bq-mode", isDark ? "dark" : "light");
  }, [isDark]);

  return (
    <BqCard className="mission-card" border="l">
      <main className="mission">
        <header className="mission__header">
          <BqAvatar initials="OR" label="Orion crew" size="medium" />
          <div className="mission__title">
            <h2>Orion launch window</h2>
            <p>Mission control · T-minus 42 min</p>
          </div>
          <BqButton
            appearance="secondary"
            border="full"
            label={isDark ? "Switch to light mode" : "Switch to dark mode"}
            onlyIcon
            size="small"
            onBqClick={() => setIsDark((prev) => !prev)}
          >
            <BqIcon name={isDark ? "sun" : "moon"} />
          </BqButton>
        </header>

        <BqAlert type="info" open disableClose>
          Info stays blue
          <span slot="body">
            Nebula sets only brand, accent and neutrals, so info, success, warning and danger keep BEEQ's values.
          </span>
        </BqAlert>

        <div className="mission__tags">
          <BqTag color="success">Fuel nominal</BqTag>
          <BqTag color="warning">Crosswind 18 kn</BqTag>
          <BqTag color="info" variant="outline">Weather update</BqTag>
        </div>

        <div className="mission__meter">
          <span>Fuel load</span>
          <BqProgress value={62} label />
        </div>

        <BqInput name="callsign" placeholder="e.g. Orion-7">
          <label slot="label">Callsign</label>
        </BqInput>

        <BqSwitch name="autopilot" checked>
          Autopilot
        </BqSwitch>

        <footer className="mission__actions">
          <BqButton appearance="text">Cancel</BqButton>
          <BqButton appearance="secondary">Save draft</BqButton>
          <BqButton>
            <BqIcon name="rocket-launch" slot="prefix" />
            Launch
          </BqButton>
        </footer>
      </main>
    </BqCard>
  );
}
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component, effect, signal } from "@angular/core";
import {
  BqAlert,
  BqAvatar,
  BqButton,
  BqCard,
  BqIcon,
  BqInput,
  BqProgress,
  BqSwitch,
  BqTag,
} from "@beeq/angular/standalone";

// Add styles.css to the "styles" array in angular.json. Component styles are
// encapsulated, so the [bq-theme] selectors would never reach <html>.

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqAlert, BqAvatar, BqButton, BqCard, BqIcon, BqInput, BqProgress, BqSwitch, BqTag],
  template: `
    <bq-card class="mission-card" border="l">
      <main class="mission">
        <header class="mission__header">
          <bq-avatar initials="OR" label="Orion crew" size="medium"></bq-avatar>
          <div class="mission__title">
            <h2>Orion launch window</h2>
            <p>Mission control · T-minus 42 min</p>
          </div>
          <bq-button
            appearance="secondary"
            border="full"
            [label]="isDark() ? 'Switch to light mode' : 'Switch to dark mode'"
            only-icon
            size="small"
            (bqClick)="isDark.set(!isDark())"
          >
            <bq-icon [name]="isDark() ? 'sun' : 'moon'"></bq-icon>
          </bq-button>
        </header>

        <bq-alert type="info" open disable-close>
          Info stays blue
          <span slot="body">Nebula sets only brand, accent and neutrals, so info, success, warning and danger keep BEEQ's values.</span>
        </bq-alert>

        <div class="mission__tags">
          <bq-tag color="success">Fuel nominal</bq-tag>
          <bq-tag color="warning">Crosswind 18 kn</bq-tag>
          <bq-tag color="info" variant="outline">Weather update</bq-tag>
        </div>

        <div class="mission__meter">
          <span>Fuel load</span>
          <bq-progress value="62" label></bq-progress>
        </div>

        <bq-input name="callsign" placeholder="e.g. Orion-7">
          <label slot="label">Callsign</label>
        </bq-input>

        <bq-switch name="autopilot" checked>Autopilot</bq-switch>

        <footer class="mission__actions">
          <bq-button appearance="text">Cancel</bq-button>
          <bq-button appearance="secondary">Save draft</bq-button>
          <bq-button>
            <bq-icon name="rocket-launch" slot="prefix"></bq-icon>
            Launch
          </bq-button>
        </footer>
      </main>
    </bq-card>
  `,
})
export class AppComponent {
  readonly isDark = signal(false);

  constructor() {
    effect(() => {
      const root = document.documentElement;
      root.setAttribute("bq-theme", "nebula");
      root.setAttribute("bq-mode", this.isDark() ? "dark" : "light");
    });
  }
}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
  import { ref, watchEffect } from "vue";
  import { BqAlert, BqAvatar, BqButton, BqCard, BqIcon, BqInput, BqProgress, BqSwitch, BqTag } from "@beeq/vue";
  import "./styles.css";

  const isDark = ref(false);

  watchEffect(() => {
    const root = document.documentElement;
    root.setAttribute("bq-theme", "nebula");
    root.setAttribute("bq-mode", isDark.value ? "dark" : "light");
  });
</script>

<template>
  <BqCard class="mission-card" border="l">
    <main class="mission">
      <header class="mission__header">
        <BqAvatar initials="OR" label="Orion crew" size="medium" />
        <div class="mission__title">
          <h2>Orion launch window</h2>
          <p>Mission control · T-minus 42 min</p>
        </div>
        <BqButton
          appearance="secondary"
          border="full"
          :label="isDark ? 'Switch to light mode' : 'Switch to dark mode'"
          onlyIcon
          size="small"
          @bqClick="isDark = !isDark"
        >
          <BqIcon :name="isDark ? 'sun' : 'moon'" />
        </BqButton>
      </header>

      <BqAlert type="info" open disableClose>
        Info stays blue
        <span slot="body">
          Nebula sets only brand, accent and neutrals, so info, success, warning and danger keep BEEQ's values.
        </span>
      </BqAlert>

      <div class="mission__tags">
        <BqTag color="success">Fuel nominal</BqTag>
        <BqTag color="warning">Crosswind 18 kn</BqTag>
        <BqTag color="info" variant="outline">Weather update</BqTag>
      </div>

      <div class="mission__meter">
        <span>Fuel load</span>
        <BqProgress :value="62" label />
      </div>

      <BqInput name="callsign" placeholder="e.g. Orion-7">
        <label slot="label">Callsign</label>
      </BqInput>

      <BqSwitch name="autopilot" checked>
        Autopilot
      </BqSwitch>

      <footer class="mission__actions">
        <BqButton appearance="text">Cancel</BqButton>
        <BqButton appearance="secondary">Save draft</BqButton>
        <BqButton>
          <BqIcon name="rocket-launch" slot="prefix" />
          Launch
        </BqButton>
      </footer>
    </main>
  </BqCard>
</template>
```

> [!NOTE]
>
> Every Nebula value passes the [contrast checklist](#contrast-checklist-for-custom-brands) in light and dark mode. If you change a color, check the pairs it affects again.

***

## How overrides work

BEEQ wraps every theme and mode selector in `:where()`, for example `:where([bq-mode="dark"])`. `:where()` has zero specificity, so any selector you write — `:root`, `.promo`, `[bq-theme="my-custom-theme"]`, or a component tag — wins over BEEQ's defaults, whichever stylesheet loads first. You don't need `!important` or extra selector weight.

> [!NOTE]
>
> Mode roles reference root semantics (e.g., `--bq-ui--brand: var(--bq-brand)`), and CSS resolves `var()` on the element that declares the role. Roles are declared on the theme/mode element, usually `<html>`, so overriding a root semantic deeper in the tree doesn't re-derive the roles below it. Override the role itself in that case.

### Override levels

Pick the narrowest level that covers your change:

> [tab] Global
>
> Change root semantics on `:root` (or your theme selector). Every mode role that points to them updates in both modes:
>
> ```css theme={"theme":{"light":"one-light","dark":"night-owl"}}
> :root {
>   --bq-brand-light:  #e0f2fe;
>   --bq-brand:        #0369a1;
>   --bq-brand-dark:   #0c4a6e;
>   --bq-brand-strong: #0369a1;
>   --bq-brand-bright: #7dd3fc;
> }
> ```
>
> A mode role set on `:root` (e.g., `--bq-text--on-brand`) applies in **both** modes. Use the per-mode level if light and dark need different values.

> [tab] Per mode
>
> Override a mode role for one mode only:
>
> ```css theme={"theme":{"light":"one-light","dark":"night-owl"}}
> [bq-mode="dark"] {
>   --bq-ui--brand:       var(--bq-brand-bright);
>   --bq-text--on-brand:  var(--bq-neutral-1000);
> }
> ```

> [tab] Subtree
>
> Override **mode roles** on a container to restyle everything inside it:
>
> ```css theme={"theme":{"light":"one-light","dark":"night-owl"}}
> .promo {
>   --bq-ui--brand:      var(--bq-purple-600);
>   --bq-text--on-brand: var(--bq-white);
> }
> ```
>
> > [!WARNING]
> >
> > Setting a root semantic such as `--bq-brand` on `.promo` doesn't change `--bq-ui--brand` inside it, because the role was already resolved on the root element. Override the roles directly, or set `bq-mode` on the container so BEEQ re-declares the roles there.

> [tab] Component
>
> Use a component's own CSS variables for a one-off change. They're listed in each component's **Styling** section:
>
> ```css theme={"theme":{"light":"one-light","dark":"night-owl"}}
> bq-alert {
>   --bq-alert--background-info: var(--bq-ui--info-alt);
> }
> ```

***

## Contrast checklist for custom brands

BEEQ's own themes are checked by an automated contrast test. When you bring your own colors, check these pairs in **both** modes before you ship. All ratios follow [WCAG 2.1 Level AA](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html).

| Pair | Minimum |
| - | - |
| `--bq-{intent}-strong` (light mode) and `--bq-{intent}-bright` (dark mode) on `--bq-background--primary`, `--bq-background--secondary`, `--bq-ui--primary`, `--bq-ui--secondary` | 4.5:1 |
| `--bq-text--{intent}` on its tint, `--bq-ui--{intent}-alt` | 4.5:1 |
| `--bq-{intent}-bright` on the dark surfaces above and on `--bq-ui--{intent}-alt` | APCA Lc 60 |
| `--bq-text--on-{intent}` on `--bq-ui--{intent}` at rest | 4.5:1 |
| `--bq-text--on-{intent}` on the hover and active mixes of `--bq-ui--{intent}` (20% `--bq-hover` / `--bq-active`) | 4.5:1 |
| `--bq-text--primary` and `--bq-text--secondary` on primary and secondary surfaces | 4.5:1 |
| Icons, `--bq-stroke--tertiary`, `--bq-stroke--{intent}`, and `--bq-focus` on `--bq-background--primary` and `--bq-ui--primary` | 3:1 |

> [!TIP]
>
> Mid-tone brand colors often can't reach 4.5:1 with white **and** stay readable on hover. If white text on your brand fill fails, either use a darker step for the fill in light mode (e.g., `--bq-ui--brand: var(--bq-brand-strong)`) or pick a dark on-color. Then check the hover and active mixes again — they shift the fill toward a dark neutral.


## Related topics

- [Themes & Modes](https://www.beeq.design/theming/themes-and-modes.md)
- [Global CSS Variables](https://www.beeq.design/theming/global-css-variables.md)
- [Colors](https://www.beeq.design/foundations/colors.md)
- [Component CSS Variables](https://www.beeq.design/theming/component-css-variables.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.