Skip to content

Themes reference

Themes are Python classes. Subclass Theme, set a typed Palette per color mode plus an optional Typography, and pass an instance to Deck(theme=...):

from dataclasses import replace

from inkflow import Deck, Palette, Theme, Typography


class MyTheme(Theme):
    dark = Palette(bg="#1e1e2e", accent="#cba6f7")
    light = replace(Theme.light, accent="#8839ef")
    typography = Typography(heading_font="Inter")


Deck(theme=MyTheme())

See the Themes guide for the full workflow, including how a theme ships its own layouts and fonts.

Theme

Base class for a deck theme. Subclass it and set class attributes.

from dataclasses import replace

class Nord(Theme):
    mode = ColorMode.DARK
    dark = replace(Theme.dark, bg="#2e3440", accent="#88c0d0")
    light = replace(Theme.light, accent="#5e81ac")
    typography = Typography(heading_font="Fraunces")

Assets live under asset_dir (a theme/ dir next to the module by default; set asset_root to relocate).

name class-attribute instance-attribute

name: str = 'Theme'

Display name. Defaults to the subclass's class name.

mode class-attribute instance-attribute

mode: ColorMode = ColorMode.DARK

Color mode a deck gets when it sets none of its own.

font_size class-attribute instance-attribute

font_size: int = 36

Base font size (px) for zone content, unless the deck or slide overrides it.

transition class-attribute instance-attribute

transition: Transition = Cut()

Slide transition a deck gets when it sets none of its own.

overlays class-attribute instance-attribute

overlays: Sequence[Overlay] = ()

Chrome composited on top of every slide, unless the deck or slide overrides it. Lets a theme ship its own branding, resolved against the theme's overlays/ directory.

dark class-attribute instance-attribute

dark: Palette = Palette()

Colors for dark mode. Defaults to the neutral dark floor.

light class-attribute instance-attribute

light: Palette = _LIGHT_FLOOR

Colors for light mode. Defaults to the neutral light floor.

typography class-attribute instance-attribute

typography: Typography = Typography()

Font families and text metrics, shared by both color modes.

asset_root class-attribute

asset_root: str = 'theme'

Asset subdirectory, relative to the module that defines the theme.

styles_path property

styles_path: Path

Where this theme's styles.css would live, whether or not it exists.

asset_dir

asset_dir() -> Path

Directory holding this theme's assets, derived from its module's file.

styles_css

styles_css() -> str

The theme's optional escape-hatch stylesheet, or "" if absent.

scripts_js

scripts_js() -> str

The theme's optional scripts, or "" if absent.

render_tokens_css

render_tokens_css() -> str

Emit the :root and :root[data-theme="light"] token blocks.

These define every --inkflow-* token; there is no CSS floor to fall back to. Typography and the dark palette go in :root, the light palette in the data-theme block.

Palette dataclass

A theme's color tokens for one color mode.

Field defaults are the neutral dark floor, so Palette() is a complete, usable palette and a subclass overrides only the tokens it names. For light, a theme overrides off Theme.light (see Theme). Semantic tokens first, then the named accent palette (consumed by syntax highlighting and the inkflow-fill-* / inkflow-stroke-* utilities).

Each field maps to a CSS custom property by kebab-casing its name, so text_muted is available to stylesheets and layouts as --inkflow-text-muted.

bg class-attribute instance-attribute

bg: str = '#1a1a1a'

Slide background.

surface class-attribute instance-attribute

surface: str = '#2a2a2a'

Card and panel background.

border class-attribute instance-attribute

border: str = '#444444'

Border and divider color.

text class-attribute instance-attribute

text: str = '#e6e6e6'

Primary text.

text_muted class-attribute instance-attribute

text_muted: str = '#a0a0a0'

Secondary, de-emphasized text.

accent class-attribute instance-attribute

accent: str = '#7aa2f7'

Accent and highlight color.

accent_fg class-attribute instance-attribute

accent_fg: str = '#1a1a1a'

Foreground on accent-colored backgrounds.

code_bg class-attribute instance-attribute

code_bg: str = '#111111'

Code block background.

code_text class-attribute instance-attribute

code_text: str = '#e6e6e6'

Code block text.

link: str = '#7aa2f7'

Link color.

heading class-attribute instance-attribute

heading: str = '#e6e6e6'

Heading color.

blockquote class-attribute instance-attribute

blockquote: str = '#444444'

Blockquote border.

red class-attribute instance-attribute

red: str = '#e06c75'

Named color: .inkflow-fill-red, .inkflow-stroke-red.

orange class-attribute instance-attribute

orange: str = '#d19a66'

Named color: .inkflow-fill-orange, .inkflow-stroke-orange.

yellow class-attribute instance-attribute

yellow: str = '#e5c07b'

Named color: .inkflow-fill-yellow, .inkflow-stroke-yellow.

green class-attribute instance-attribute

green: str = '#98c379'

Named color: .inkflow-fill-green, .inkflow-stroke-green.

teal class-attribute instance-attribute

teal: str = '#56b6c2'

Named color: .inkflow-fill-teal, .inkflow-stroke-teal.

blue class-attribute instance-attribute

blue: str = '#61afef'

Named color: .inkflow-fill-blue, .inkflow-stroke-blue.

purple class-attribute instance-attribute

purple: str = '#c678dd'

Named color: .inkflow-fill-purple, .inkflow-stroke-purple.

pink class-attribute instance-attribute

pink: str = '#d787af'

Named color: .inkflow-fill-pink, .inkflow-stroke-pink.

grey class-attribute instance-attribute

grey: str = '#7f848e'

Named color: .inkflow-fill-grey, .inkflow-stroke-grey.

Typography dataclass

A theme's typography tokens. Heading sizes are fixed in the contract.

Fields map to CSS custom properties the same way Palette's do, so body_font is available as --inkflow-body-font. Font values are ordinary font-family values: ship the file in the theme's fonts/ directory to have it embedded.

body_font class-attribute instance-attribute

body_font: str = 'sans-serif'

Body font-family.

heading_font class-attribute instance-attribute

heading_font: str = 'sans-serif'

Heading font-family.

mono_font class-attribute instance-attribute

mono_font: str = 'monospace'

Code font-family.

line_height class-attribute instance-attribute

line_height: float = 1.4

Body line height.

heading_weight class-attribute instance-attribute

heading_weight: int = 600

Heading font-weight.

heading_line_height class-attribute instance-attribute

heading_line_height: float = 1.2

Heading line height.

Builtin

Bases: Theme

The default theme: Catppuccin (Mocha dark / Latte light).