Getting started

Themes

Every colour, font, radius and motion is a token. Pick a theme, switch light and dark, and every block follows.

A theme is a set of CSS variables. Components and blocks use only those variables, never a fixed colour. Swap the stylesheet and everything changes together, in light and dark.

The default theme

The first item you install brings the default theme into components/trame/styles/. Once it is imported (see Installation), you have a complete theme with nothing else to do.

Use another theme

Browse the themes on the themes page: each one shows its palette, type and a live preview. To use one, install the themes package:

npm install @trame-ui/themes

Then, in your app’s main CSS, import that theme’s files instead of the default ones. For the sage theme:

@import '@trame-ui/themes/themes/sage/css/tokens.css';
@import '@trame-ui/themes/themes/sage/css/theme-light.css';
@import '@trame-ui/themes/themes/sage/css/theme-dark.css';
@import '@trame-ui/themes/themes/sage/css/theme-moods.css';
@import '@trame-ui/themes/themes/sage/css/type.css';
@import '@trame-ui/themes/themes/sage/css/controls.css';
@import '@trame-ui/themes/themes/sage/css/motion.css';

Each theme page on this site lists the same lines with its own name. Some themes use their own fonts: load them as you load any web font.

Light and dark

Light is the default. Set the dark class on the <html> element for dark:

<html class="dark">

A part of the page can stay light inside a dark page with the light class on its container.

Moods

A section can wear a mood: the class mood-brand, mood-tint, mood-warm or mood-inverse on its container. The mood changes the background and the colours inside it, and every text pair stays readable.

Your own theme

Generate one: the theme generator takes your brand colour and your decisions and writes the whole set, with every text pair checked for a contrast of at least 4.5:1 in every mode and mood. The shipped CSS carries resolved literals (no palette primitives), so override a SEMANTIC variable (--background, --brand…) in your own CSS after the imports for a one-off — and use the generator to re-colour everything coherently.