English
Themes
theme.css decides how a deck looks. Slides supply structure and class names; the theme supplies the shared look, and a slide's own slides/<id>.css adds decoration that only that slide uses. This page covers the token contract, how to grow a theme's vocabulary, and why each deck owns a copy.
Thirteen tokens
If class names are the contract between HTML and theme, custom properties are the surface where appearance is swapped. Every theme publishes these thirteen tokens on .slide. They live on .slide, not :root, so they never leak into the presenter chrome. That is the same reason top-level selectors are forbidden (DEK012). The view transition sits outside every slide, so dek hands it the tokens set on .slide as well; see View Transitions.
| Token | Role |
|---|---|
--fg --bg --accent --muted | Color |
--font-title --font-body | Type |
--size-title --size-body --size-caption | Size |
--gap --pad | Space |
--radius | Corners |
--step-transition | Motion |
The color tokens are all meant for text. In the bundled theme, --fg, --muted, and --accent each reach 4.5:1 against --bg, so any of them passes DEK031 as body text. Keep that true when you change them.
Raw colors, font-family values, and absolute units may appear only when assigning a --* property. Everywhere else, use var() or calc(var() …). Unitless 0, thin, and em are allowed. A var() with a raw fallback, such as var(--fg, #fff), counts as a raw value. A missing token is DEK015; a raw value outside a token is DEK014. You may add as many deck-specific tokens as you like.
Every selector must sit under .slide. ::view-transition-* pseudo-elements and at-rules such as @keyframes and @media are the only exceptions.
Growing the vocabulary
A class the theme does not define is DEK010. You clear it by adding the class to theme.css. That is intentional: extending the vocabulary is a design decision, and lint should not forbid it. Lint's job is to make the decision cost one deliberate step and to leave a reviewable diff. DEK013 caps the total class count (40 by default) so that step is not repeated forever.
New classes land in the deck's own theme.css, so no other deck is affected. When a class earns its place, lift it into the project theme with cp.
Not every class deserves that step. Decoration that one slide uses goes in that slide's own stylesheet instead, where it neither counts toward DEK013 nor leaks into other slides. See Slide stylesheets.
Layout examples
A layout is a promise about markup: split expects a parent node and two results, tree a parent and a stack. Write that promise down as a comment directly above the layout's first rule, and it travels with the theme.
css
/* @layout split
<section class="slide" data-layout="split">
<h2 class="slide-title">One source, two results</h2>
<p class="node node-parent">Source</p>
<p class="node" data-step="1">Result</p>
<p class="node" data-step="2">Result</p>
</section>
*/
.slide[data-layout="split"] {dekc theme split prints the example, and dekc theme lists which layouts have one. The bundled theme and the sample's themes carry an example for every layout, so an agent can start a slide from the markup the layout was designed for instead of guessing.
Slide numbers
Every slide carries its place in script.md: --dek-slide-number counts from 1, and --dek-slide-count is how many slides the deck has. The build, the dev server, shots, and the PDF all set them the same way, so a folio printed from them follows the script whenever a slide is added, removed, or moved with dekc mv. Nothing in the slide's HTML holds a number.
Pass them to a CSS counter to print them in any counter style:
css
.slide {
counter-reset: folio var(--dek-slide-number) folios var(--dek-slide-count);
}
.slide::after {
content: counter(folio, decimal-leading-zero) " / " counter(folios);
}Which slides show a folio is the theme's call, as it is in a book: hide it on the cover with .slide[data-layout="cover"]::after { content: none; }, and the cover still counts as slide 1.
Line breaks
A line ends wherever the browser runs out of room, which neither the script nor the slide's HTML shows. The bundled theme asks for lines that end where a reader would pause:
css
.slide {
word-break: auto-phrase;
text-wrap: pretty;
}
.slide .slide-title {
text-wrap: balance;
}word-break: auto-phrase breaks Japanese between phrases instead of between any two characters. It works when the deck's lang is ja, which dek reads from the script when the frontmatter leaves it out. text-wrap: pretty keeps a paragraph from ending on a word left alone, and text-wrap: balance evens out a heading's lines. Shots, the PDF, the PPTX, and the video are all drawn in Chromium, so they all break the same way.
A built deck and the dev server's player open in the viewer's own browser, and Safari and Firefox do not support auto-phrase: they break Japanese between any two characters. For a deck in Japanese, dekc build and the dev server find each slide's phrases with BudouX, and in a browser without auto-phrase the player puts a <wbr> where each phrase starts. Each word-break: auto-phrase in the deck's CSS gets word-break: keep-all in front of it, which such a browser keeps. Chromium reads the slides as it did before. Safari and Firefox then break between phrases too, though not always between the same ones Chromium picks, so a shot shows the slide as Chromium draws it.
A deck owns its copy of the theme, so a deck made before these lines keeps breaking as it did until you copy them into its theme.css; dekc lint --visual points it out as DEK035, a line that ends inside a phrase or a paragraph that ends on a remnant. Once the lines are in, DEK035 reports no line that ends inside a phrase: it finds one by comparing the text with the same text broken by phrase, and the two are now the same. A break that still reads wrong, such as a line that starts with a particle, is where Chromium's own phrases put it, or inside a phrase too long for its line, so look for it in dekc shot. Where you want a break the browser would not choose, write <br> in the slide.
Copy, then freeze
The project's theme.css is the starting point for new decks. Edits flow in one direction: down into a new deck on creation, and back up by hand when you decide something is worth keeping.
bash
dekc new 2026-09-dek
dekc new 2026-09-dek --theme-from 2026-04-vite
dekc new 2026-09-dek --theme-from hajimism/dek/why-dek
cp decks/2026-09-dek/theme.css theme.css--theme-from takes a ref too, to start a deck on another project's theme and build on its layouts; see Projects and Decks.
The reasoning is in Projects and Decks.
Next
Turn conventions into a loop you cannot forget: Lint.