Named themes
A named theme is a full set of tokens from @recit/theme: colors as HSL triplets, fonts and the
motion type scale. A story that names one keeps the same theme as a deck and as a video: the
slides read the tokens as CSS variables, the film reads the same tokens through the motion blocks.
| Theme | Look | Mode |
|---|---|---|
warm-editorial | Yeseva One and Josefin Sans over cream, deep rose | light |
saas-product | Space Grotesk on grey and white, purple primary | light |
Switching theme
Name the theme in the front matter of a story, whatever its format:
Markdown
or for every story of a project, in recit.config.ts:
recit.config.ts
- In a site, the
themeof the site config styles the site: name the story's theme in its front matter, or in therecit.config.tsnext to the story. - The other
themekeys still apply and override the named theme, one token at a time:theme: { name: "saas-product", colors: { primary: "#e11d48" } }. theme:names a theme. The display mode iscolorMode: light | dark | system.theme: lightstill works and warns, because it used to mean the mode.- A deck opens in the mode its theme is drawn for (both are light), unless
theme.defaultModeis set. The named theme keeps its tokens in both modes. - An unknown name is a warning, and the default tokens apply.
The same story, two formats
This story names warm-editorial. It is played below as slides, then as a film paused at 3.5
seconds:
In a film
A film looks for its theme in this order: the front matter theme, the theme of a nested
motion: block, motion.theme in recit.config.ts, then theme.name. A deck reads only
theme.name and the front matter. Use motion.theme when the film must differ from the slides, or
for a brand theme imported into a themes/ folder, which only the motion format knows.
The tokens map to the film like this:
| Deck token | Film token |
|---|---|
background | bg |
card | surface |
foreground | text |
mutedForeground | muted |
primary | accent |
fonts.heading | display |
fonts.sans | body |
fonts.mono | mono |
The data palette (comparison bars) and the type scale of the motion blocks are part of the named
theme too. In code, toMotionTheme of @recit/theme/motion does the conversion, and RECIT_THEMES
of @recit/theme lists the themes.