Skip to Content

Theming

The root class, the dark and light themes, and the accent.

The root

<div class="nc" data-theme="dark" style="--accent: #8b7cf6">…</div>
  • Put class="nc" on the root of the app.
  • Set data-theme="dark" or data-theme="light" on the same element.
  • Set --accent on that element to change the accent.

The tokens for each theme are on [data-theme], so a subtree can take the other theme. Dark is the default: tokens.css declares the dark values on :root as well.

Chips, badges, avatars, state
Open the example ↗

The accent

--accent is the one colour an app sets. The default is Iris. ACCENTS lists the six presets the gallery offers, and accentValue(id, theme) gives the value of a preset in a theme.

import { accentValue } from "@aiviarium/nocturne"

root.style.setProperty("--accent", accentValue("jade", "dark"))
PresetDarkLight
Iris iris#6262EE#5B5BE0
Azure azure#3B82F6#2563EB
Jade jade#10B981#0E9F6E
Ember ember#F97316#EA580C
Rose rose#F43F5E#E11D48
Graphite graphite#8E8E99#6B6B75

The other accent tokens (--accent-strong, --accent-text, the tint, line and glow) hold the Iris values in tokens.css. See Colour.

The six presetsEach card sets --accent on an element that also carries data-theme; bundle.css derives the rest. The primary button stays neutral in every accent.
Open the example ↗

Overlays take the theme

Popovers, menus, dialogs, tooltips and toasts mount inside the nearest [data-theme] element. They inherit its theme and accent. See Overlays.

Parts and props

Each component root has a stable data-part attribute, such as data-part="list-row". Tests and app CSS can find a part by it. Props are documented with TSDoc in the sources.

Editor classes

The editor's classes are nc-editor, nc-editor__content and nc-editor-*.

Edit on GitHub

Last updated on

On this page