vidmake v0.2.1
Download

Docs/StylePage 30 / 45

Theme

The project's theme holds its design tokens (colors, spacing, type styles, motion and layer styles) for every composition, written "$color.accent". Aliases, modes such as --theme dark, token files with extends, W3C design-token (DTCG) files, vidmake theme and migrating from 0.5 tokens.

View .md Ask Claude Ask ChatGPT

Props belong to one composition. A brand's colors, type, spacing and motion belong to the whole project and to every component in it. They go in the project's theme, and every composition reads them as "$name", components included, without forwarding anything.

project.jsonjson
{  "theme": {    "color":  { "ink": "#161412", "paper": "#f4f1ea", "accent": "oklch(54% 0.19 28)", "muted": "{color.ink}/60%" },    "space":  { "s": 16, "m": 32, "l": 64 },    "type":   { "display": { "font": "Schibsted Grotesk", "size": 96, "weight": 860, "tracking": -0.045, "leading": 0.95 },                "label":   { "font": "JetBrains Mono", "size": 16, "weight": 500, "tracking": 0.12, "uppercase": true } },    "motion": { "house": { "spring": 0.15, "duration": "0.5s" } },    "styles": { "card": { "fill": "$paper", "cornerRadius": 4 } },    "modes":  { "dark": { "color": { "ink": "#efebe2", "paper": "#131210" } } }  },  "compositions": [ ... ]}

Groups are free-form: name them as you like (color, space, radius, brand...). Four have a meaning:

groupholds
typetype styles, applied with style (see Type styles)
motionnamed motions, usable as "motion": "house"
styleslayer styles, applied with style (see Styles)
modespartial overrides applied with --theme <mode> (see Modes)
00:00.0 · f 000
One theme, read by every composition: colors, type styles, a layer style and a house motionDownload

The two cards are the same card composition placed with use layers. It reads $color.card, $type.label, $type.display and $styles.card straight from the theme; only the words come in as props.

#References

A value that is exactly "$color.accent" becomes the token's value. A number stays a number and a style stays an object:

json
{ "id": "rule", "type": "rect", "width": "$space.l", "height": 4, "fill": "$color.accent" }
  • Short names. A leaf name alone works when only one token has it: "$accent" for $color.accent. When two groups share a leaf, validate lists the matches and asks for the full path.
  • Expressions. In an = expression the value is spliced in: "=lerp($ink, $accent, p)", "x": "=$space.l * i".
  • Text. Only inside ${...}: "Price $5" stays literal, "${$space.l}px" prints 64px.
  • Errors. An unknown token is an error with a suggestion: unknown theme token `$color.acent` — did you mean `$color.accent`?

#Aliases

A token may point at another one, with the W3C syntax "{color.ink}" or as "$color.ink". Add /60% to get the same color at 60% alpha:

json
"color": { "text": "#161412", "pencil": "#c92a26", "accent": "{color.pencil}", "line": "{color.text}/90%" }

Aliases resolve after modes apply, so a mode that changes pencil changes accent too, and one that changes text changes line. A missing target or a cycle is an error that names the chain (theme alias cycle: a → b → a).

#Styles

style on a layer merges theme fields under the layer's own fields: the layer always wins. A list applies in order, later entries over earlier ones:

json
{ "type": "text", "text": "Ship it", "style": "$type.display", "fill": "$accent" }{ "type": "rect", "width": 480, "height": 300, "style": ["$styles.card", { "cornerRadius": 0 }] }

A style in styles is a set of layer fields: { "fill": "$paper", "cornerRadius": 4, "shadow": { ... } }.

#Type styles

Type styles in type use design words, which become text fields:

keylayer field
fontfont
sizefontSize
weightfontWeight
leadinglineHeight
trackingletterSpacing, in em of the size: -0.02 on 96 px is −1.92 px
uppercase, italicthe same

Any other key is passed through as a layer field, so a type style can also set fill or align.

#Modes

modes holds partial overrides. --theme dark lays modes.dark over the theme before aliases resolve, on every command that compiles: render, still, storyboard, validate, inspect, timeline, trace and theme.

bash
vidmake render project.json -o out/dark.mp4 --theme dark

The demo above has a dark mode that changes four colors. The card's stroke is an alias of text and the rule an alias of pencil, so both follow:

vidmake still theme-basics.json -t 2s --theme dark
$ vidmake still theme-basics.json -t 2s --theme dark

--theme-file brand.json lays a whole file over the theme instead, for a second brand or a client's colors. An unknown mode is an error that lists the modes the theme has.

#Files

A theme can live in its own file, so one file themes every video you make for a brand:

json
"theme": "brand/theme.json""theme": { "extends": "brand/tokens.json", "color": { "accent": "#c92a26" } }

extends (a path or a list of paths) loads files underneath the local tokens, so the project overrides the file. Paths are relative to the project file.

#W3C design tokens

Files in the W3C design-token format (DTCG) work as a design tool exports them: $value and $type are read (a group's $type applies to the tokens inside it), other $ keys such as $description are ignored. Typed values become vidmake values:

$typebecomes
colora color: a string, or { "colorSpace": "srgb" | "hsl" | "oklch" | "oklab", "components": [...], "alpha" }
dimensionpx (rem is 16 px)
durationa time
cubicBezieran easing
fontFamily, fontWeight, numberthe value
typographya type style
shadowa shadow object
gradientgradient stops
transitiona motion

A transition token outside theme.motion is used with a reference: "motion": "$transition.quick".

#vidmake theme

vidmake theme lists every token with its resolved value and marks the ones nothing uses. Add --theme <mode> to see a mode, or --json for a script:

vidmake theme theme-basics.json
$ vidmake theme theme-basics.json
$color.ground  #f4f1ea
$color.card    #fbf9f4
$color.text    #161412
$color.mute    #8a857a
$color.pencil  #c92a26
$color.accent  #c92a26
$color.line    #161412e6
$type.display  {"font":"Schibsted Grotesk","size":92,"weight":860,"tracking":-0.045}
$type.label    {"font":"JetBrains Mono","size":16,"weight":500,"tracking":0.16,"uppercase":true}
$motion.house  {"spring":0.2,"duration":"0.6s"}
$styles.card   {"fill":"#fbf9f4","stroke":"#161412e6","strokeWidth":2,"cornerRadius":4}
modes: dark (apply with --theme <mode>)

#From 0.5

vidmake 0.5 had a top-level tokens object read as {{color.accent}}, and a top-level easings object. Both still work with a warning. {{name}} is now for props only.

0.5now
"tokens": { ... }"theme": { ... }
"fill": "{{color.accent}}""fill": "$color.accent"
"easings": { "house": ... }"theme": { "motion": { "house": ... } }

vidmake migrate rewrites a project in place (pretty-printed). --check only reports what it would change and exits 1 if anything would:

bash
vidmake migrate project.json --checkvidmake migrate project.json
output
  moved `tokens` to `theme`  composition `tokens`: 1 `{{token}}` reference(s) now `$token`  composition `card`: 5 `{{token}}` reference(s) now `$token`migrated project.json

For agents

Put every color, size and motion that appears more than once in the theme, then write "$name". Check with vidmake theme project.json: an (unused) token is safe to delete.

#Next steps