# Light, dark or match your site (https://notert.io/docs/widget/theme)

Last updated 2026-11-24

The widget draws light or dark. `theme` in the snippet's `init` call says which, and the default, `"page"`, makes it match your site without any code: a light page gets a light widget, a dark page a dark one, and your site's own light and dark switch moves the widget with it.

<Screenshot name="widget-on-site" alt="Brightline's pricing page, drawn light, with its widget open in the bottom-right corner on its first screen, light to match the page." />

Here Brightline's widget sits on its own pricing page with `theme: "page"`. Switch this site between light and dark and the picture follows, as the widget does on Brightline's page.

## The four themes [#the-four-themes]

| `theme`   | Draws                                                                           | Install guide         | Use it when                                                             |
| --------- | ------------------------------------------------------------------------------- | --------------------- | ----------------------------------------------------------------------- |
| `"page"`  | Light or dark as your page does, following your site's switch. The default.     | <Key>Match site</Key> | Almost always: your site has a dark mode, or might one day.             |
| `"light"` | Always light.                                                                   | <Key>Light</Key>      | Your site is only ever light and you never want a dark widget.          |
| `"dark"`  | Always dark.                                                                    | <Key>Dark</Key>       | Your site is only ever dark.                                            |
| `"auto"`  | As each visitor's system is set, whatever your page draws, and follows it live. | none                  | You want the visitor's own setting, even on a page that's always light. |

On a site that only draws a light page, `"auto"` gives a visitor whose system is dark a dark widget on your light page, where `"page"` gives them a light one.

```html
<script>
  window.$notert=window.$notert||[];window.notert=window.notert||new Proxy({},{get:(_,p)=>typeof p=="string"&&p!="then"&&/^[a-z]/i.test(p)?(...a)=>window.$notert.push([p,...a]):void 0});
  window.notert.init("YOUR_WORKSPACE_ID", { widget: true, theme: "page" });
</script>
<script type="module" async src="https://app.notert.io/embed/v1.js"></script>
```

With the npm package, `theme` is typed as `NotertTheme`:

```ts
import { loadNotert } from "@notert/widget";

loadNotert({ workspaceId: "YOUR_WORKSPACE_ID", theme: "page" });
```

In `init`, any other value, or none, is read as `"page"`, without a warning.

## Your team's Mode comes first [#your-teams-mode-comes-first]

On the Professional plan, your team sets the widget's <Key>Mode</Key> on the Widget design page in Notert:

- **<Key>Light</Key> or <Key>Dark</Key>** draws that one for every visitor, whatever `theme` says, so your page's `theme` changes nothing. Its other `appearance` values still apply.
- **<Key>System</Key>** leaves it to your page, as this page describes. It's the mode of every template but Midnight, which is <Key>Dark</Key>.

On another plan there's no mode, and `theme` alone decides. Which colors each one draws in is the design's; see [design your widget](/support/conversations/design-your-widget) and [colors and readability](/docs/widget/appearance#colors-and-readability).

## How `"page"` reads your page [#how-page-reads-your-page]

The widget looks at your page's `<html>`, then its `<body>`, and takes the first of these it finds:

1. **A theme class or attribute**: a `dark` or `light` class, or one of these attributes set to `"dark"` or `"light"`, as most theme switchers write them:

   | Attribute               | Written by, for instance |
   | ----------------------- | ------------------------ |
   | `data-theme`            | next-themes, daisyUI     |
   | `data-mode`             | many theme switchers     |
   | `data-color-mode`       | GitHub's Primer          |
   | `data-color-scheme`     | many theme switchers     |
   | `data-bs-theme`         | Bootstrap                |
   | `data-mui-color-scheme` | MUI                      |

2. **The background** `<html>` or `<body>` paints, dark or light. Where neither paints one, as in an app that paints its background on an element inside `<body>`, the background drawn behind your content 8px in from the middle of the window's right edge, then at its middle. The right edge comes first, since a sidebar usually sits on the left.
3. **Your page's `color-scheme`**: `dark` draws dark, and `light dark` follows the visitor's system, as your page's own canvas does.

With none of these, it draws light.

A few things follow from this:

- **The class must be exactly `dark` or `light`.** A class such as `theme-dark` or `is-dark` isn't read; an attribute's value is read in any case, so `data-theme="Dark"` counts.
- **Only `<html>` and `<body>` are watched.** A theme class on `#root` or `#app` isn't seen, though the background it paints usually is.
- **A background is a color.** A background picture or gradient paints no color, so the widget looks past it. A color counts as dark below half lightness, and only where it's at least half opaque.
- **It follows at once.** When your switch changes a class, a style or one of these attributes on `<html>` or `<body>`, or your framework swaps the `<body>`, the widget reads the page again at once, and again 400ms later, once a fade on your background has settled.
- **A style written every frame is read every 400ms.** If your page writes an inline style on `<html>` or `<body>` many times a second, as a scroll or pointer effect does, the widget reads the page once every 400ms while that goes on, so it costs your animation nothing. A switch made by a class or attribute is still read at once; one made by an inline style alone is followed within 400ms.

## Matching your site's own theme switch [#matching-your-sites-own-theme-switch]

With `"page"`, a switch that sets a class or attribute on `<html>` or `<body>` needs nothing more. That covers next-themes, Tailwind's `dark` class, Bootstrap's `data-bs-theme` and MUI's color schemes as they ship.

If your switch marks nothing there and paints its background further in, tell the widget yourself each time a visitor flips it:

```js
// Wherever your switch changes the theme:
window.notert.appearance({ theme: nowDark ? "dark" : "light" });
```

In React, with the npm package, call it from an effect on your own theme state:

```tsx
import { notert } from "@notert/widget";
import { useEffect } from "react";

export function useWidgetTheme(dark: boolean) {
  useEffect(() => {
    notert.appearance({ theme: dark ? "dark" : "light" });
  }, [dark]);
}
```

The widget follows at once, open or shut. `appearance` takes the same four themes as `init`, so `"page"` hands the choice back to your page and `"auto"` to the visitor's system setting. Unlike `init`, any other value is left out with a warning in the browser's console, `Notert: appearance.theme was ignored.`, and the widget keeps the theme it had.

You can also set `theme` inside `init`'s `appearance`, which goes over the `theme` beside it, as each later `appearance` call does.

## If it draws the wrong one [#if-it-draws-the-wrong-one]

- **It's always light, or always dark.** Check <Key>Mode</Key> on the Widget design page: <Key>Light</Key> or <Key>Dark</Key> overrides your page. Then check your snippet's `theme`.
- **It draws light on your dark page.** Your switch probably marks nothing on `<html>` or `<body>`, and the background behind your content is a picture or gradient, or not dark enough. Add a `dark` class or `data-theme="dark"` to `<html>`, or call `appearance` from your switch as shown above.
- **It's a step behind your switch.** A page that fades its background over more than 400ms can be read mid-fade. Mark the theme on `<html>`, which is read before the background, or call `appearance` from your switch.
- **It's dark for some visitors on your light site.** That's `"auto"`, which follows each visitor's system. Use `"page"` to match your site instead.