Themes
A theme is a set of CSS:root custom properties — --slide-* variables — that the renderer applies to every slide in a deck. You define a theme once, apply it to a deck, and from that point every layer that references a theme token (like var(--slide-brand)) picks up the right color and font automatically.
Creating a theme
You can create a theme with structuredcolors and fonts objects, or by writing raw CSS if you need full control.
- Structured (recommended)
- Raw CSS
Pass
colors and fonts to themes.create(). The SDK compiles them into a complete :root block with all --slide-* variables and typography defaults baked in.Applying a theme to a deck
UseapplyTo in the themes.create() call to attach the theme to a deck in one atomic operation:
Theme color tokens
The SDK exports acolorRef() helper that resolves a token name to the corresponding CSS variable string. Use it anywhere a layer field accepts a color value — fill, color, backgroundColor, and so on — to bind the layer to the theme rather than hard-coding a hex value.
Theme tokens reference
Color tokens
| Token | CSS variable |
|---|---|
brand | --slide-brand |
brandLight | --slide-brand-light |
surface | --slide-surface |
card | --slide-card |
border | --slide-border |
text | --slide-text-color |
textMuted | --slide-text-muted |
Font tokens
| Token | CSS variable |
|---|---|
title | --slide-font-title |
heading | --slide-font-heading |
body | --slide-font-body |
heading and body tokens are set via the fonts.heading and fonts.body fields in the structured theme spec. The title token can be set independently in raw CSS when the title style requires a different font family. You reference font tokens indirectly through the style field on text layers — style: 'title' uses --slide-font-title, style: 'h1' uses --slide-font-heading, style: 'body1' uses --slide-font-body.Layouts
A layout is a reusable slide template. It contains static chrome — a background, logo, decorative shapes — alongside named placeholder slots. Each placeholder marks a region where variable content goes. When you create a slide from a layout, you fill the placeholders by name and the SDK merges the static chrome and the filled content into a single request.Creating a layout
Callablo.layouts.create() with the layoutId of the container (the same layoutId you’d assign to a deck), a name, and a layers array. Any layer that should be a placeholder gets a placeholder field — either a bare name string or a PlaceholderSpec object.
Placeholder types
Thetype field in a PlaceholderSpec describes the kind of content the slot expects. It drives how the renderer displays the empty slot and how master layout inheritance works (a layout’s title placeholder covers the master’s title placeholder). If you omit it, the SDK infers the type from the layer’s content type.
type value | Inferred when |
|---|---|
'image' | Layer type is image |
'chart' | Layer type is chart |
'table' | Layer type is table |
'body' | Layer type is text |
'other' | All other layer types |
Creating slides from a layout
Callablo.layouts.createSlide() with the LayoutResource returned from layouts.create(), the deckId, an order, and a fill map keyed by placeholder name.
Master layouts
A master layout is a special template in a container whose chrome is inherited by every other layout in that container. Mark a layout as master by passingmaster: true when creating it. Slides that opt out of master compositing can set showMasterShapes: false.