Eunomia @eunomia/elements@eunomia/charts@eunomia/core
AllAngularReactNext.jsJavaScriptVue
EunomiaSalmonForestVioletOceanGoldFireCustom…
🇬🇧 English🇫🇷 Français

Theming

Every visual choice in Eunomia, colors, spacing, corner rounding, shadows, fonts, comes from a single design system rather than being fixed inside each component. Switch the active brand or flip between light and dark, and everything on the page updates immediately: no rebuild, no page reload, no per-component work. Your app gets this whether you install one of the 7 prebuilt themes as-is or generate a custom one from your own brand colors.

How tokens are named

Every one of those values, a color, a spacing value, a font size, is exposed as a small, named unit called a token. In plain CSS terms a token is just a variable: a name that stands in for a value, so the actual color or size only has to be defined once and can then be reused, and swapped, everywhere. Every token name starts with --eun- and follows the same shape after that, --eun-[what it is]-[which variant], for example --eun-color-primary-500 (the primary brand color, at its "500" shade), --eun-space-m (a medium spacing value), or --eun-font-size-s (a small font size). Learn a handful of these and you can usually guess the name of any other one.

Because tokens are plain CSS, not compiled values baked in ahead of time, switching a theme never needs a rebuild: the browser just looks up the same token names against a different set of values.

How switching works

Two independent attributes on <html> control the active theme:

<html data-brand="eunomia" data-theme="light"></html>
  • data-brand selects one of the 7 prebuilt palettes (eunomia, salmon, forest, violet, ocean, gold, fire), or custom.
  • data-theme is light or dark.
Primary these three all read straight off the active brand/mode

Both attributes come from styles/eunomia-themes.css, shipped in @eunomia/core and @eunomia/elements. It compiles each palette's full token set (colors, fonts, spacing, radius, shadows) into one [data-brand] selector, plus one [data-brand][data-theme="dark"] selector, so a single attribute pair is always enough. It holds every palette at once, which is what switching at runtime needs. To ship a single palette instead, each one also comes as its own stylesheet, with a .eunomia-<name>-theme class to combine with the base .eunomia-theme class: see Prebuilt themes.

For component authors

Reference tokens directly. Never hardcode a color, size, or radius:

.eunomia-button {
  background: var(--eun-color-primary-500);
  color: var(--eun-color-on-primary-500);
  border-radius: var(--eun-border-radius-m);
  padding: var(--eun-space-xs) var(--eun-space-m);
  font-family: var(--eun-font-family);
}

.eunomia-button:hover {
  background: var(--eun-color-primary-600);
}

Because the token exists on every brand and mode, the component repaints correctly no matter which theme is active. Nothing in the component itself needs to know about brands or dark mode.

Sections

Prebuilt themes

7 ready-made palettes to preview and pick from

Custom theme

Build your own palette from two brand colors

Light & dark via transparency

How colors adapt automatically between light and dark mode

Token reference

Every color token a theme defines, and how to change it

Color

The shared colors every theme has in common