Theming
elements man style/themingAn Elements app is monochrome by default and takes a brand color from one override of the accent tokens.
Monochrome by default
themes/default.css sets --accent to --neutral-900. Since every primary
button, link, focus ring, selected state, and accent surface reads --accent,
an unbranded app is black-and-white, a deliberate, finished look with zero
configuration. There is no "pick a color to get started" step.
Branding sets the accent tokens
Branding means overriding the accent token block in a theme rule imported after
the package, inside @layer tokens:
Theme override@import "@elements/ui"; @layer tokens { :root { --accent: #ff0080; --accent-deep: #cc0066; --accent-soft: #ffe0ef; --accent-ink: #5c0030; } }
Components that use the accent read these tokens, so the four lines recolor
the whole system. The @layer tokens wrapper puts the override in the same
layer as the default theme. Both rules use :root, and the override comes
later, so its values apply. See
branding (opens in a new tab) for the light-touch and full-ramp recipes.
Dark mode is automatic
Components never check whether the app is in light or dark mode. They only read
semantic tokens (--bg, --ink, --accent, …). Because themes/default.css
remaps those tokens for dark mode, anything built from tokens is dark-ready with
no extra work. The OS preference is the default; a data-theme attribute on
<html> forces a mode. See dark-mode (opens in a new tab).
- branding (opens in a new tab): the one-accent override and the full brand-ramp recipe.
- dark-mode (opens in a new tab): the OS preference, the
data-themetoggle, and why components are dark-ready with no extra work.