Skip to main content

Generate branded Office templates from design tokens

Project description

TokenMoulds

PyPI Downloads Python License: MIT CI Tests MCP Tools

Generate branded Office templates from design tokens. Point it at a brand, get publication-quality Word, PowerPoint, Excel, LibreOffice, and Google Workspace templates — with embedded fonts, baseline grids, and OOXML compliance validation.

Install

pip install tokenmoulds

Quick Start

Generate templates from brand inputs:

tokenmoulds --org-id="acme" \
  --font-pair="inter-roboto" \
  --primary-color="#2563EB" \
  --secondary-color="#DC2626" \
  --locale="GB" \
  --brand-tone=0.3 \
  --generate-templates --generate-odf

Or from a DTCG token file:

tokenmoulds --org-id="acme" \
  --tokens-file="design.tokens.json" \
  --generate-templates

What It Does

~30 brand inputs (colors, fonts, tone) produce 4,576 derived design tokens across 11 output formats. Every template ships with:

  • WCAG AAA accessible contrast ratios
  • Embedded fonts with ODTTF obfuscation
  • Baseline grid-snapped typography via modular type scales
  • ISO 29500 (OOXML) and ODF schema compliance
  • Zero macros — all styling baked into document structure

Output Formats

Format Extension Highlights
Word .dotx 276 themed paragraph, character, and table styles
PowerPoint .potx Theme colors, embedded fonts, table styles, layouts
Excel .xltx Themed cell styles and number formats
Writer .ott 110 ODF styles with page geometry
Impress .otp ODF presentation template
Calc .ots ODF spreadsheet template
Draw .otg ODF drawing template
Google Docs .dotx Optimized for Google Workspace import
Theme .thmx Standalone Office theme package

MCP Server

For AI-assisted document creation via Claude, Cursor, or other MCP clients:

tokenmoulds mcp-server

28 tools for brand extraction, template generation, document creation, validation, and cache management. See the MCP tool catalog.

Python API

from tokenmoulds.pipeline import BuildConfig, build

result = build(BuildConfig(
    org_id="acme",
    output_formats=["potx", "dotx", "xltx"],
    brand_inputs={
        "font_pair": {"sans": "Inter", "serif": "Roboto Slab"},
        "base_colors": {"primary": "#2563EB", "secondary": "#DC2626"},
        "locale": "US",
        "brand_tone": 0.5,
    },
))

for fmt, data in result.artifacts.items():
    open(f"acme.{fmt}", "wb").write(data)

Architecture

TokenMoulds uses a single canonical build pipeline:

Design Tokens → DesignResolutionEngine → DocumentIR → Emitters → Validated Packages
  • DTCG pipeline: W3C Design Tokens Community Group format with 5-layer resolution (core/fork/org/group/personal)
  • Design engine: Modular type scale, baseline grid, OpenType features, tone/density adaptation
  • Document IR: Format-agnostic intermediate representation
  • 11 emitters: Each produces a complete, valid package
  • Validation: In-process ISO 29500 schema checking via openxml-audit

See ADR 027 for the full convergence story.

Development

git clone https://github.com/BramAlkema/TokenMoulds.git
cd TokenMoulds
python -m venv venv && source venv/bin/activate
pip install -e ".[dev]"
python -m pytest tests/ -v --tb=short   # 1,629 tests

Contributing

See CONTRIBUTING.md for development guidelines, code conventions, and how to submit changes.

Documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tokenmoulds-3.0.1.tar.gz (508.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tokenmoulds-3.0.1-py3-none-any.whl (583.6 kB view details)

Uploaded Python 3

File details

Details for the file tokenmoulds-3.0.1.tar.gz.

File metadata

  • Download URL: tokenmoulds-3.0.1.tar.gz
  • Upload date:
  • Size: 508.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tokenmoulds-3.0.1.tar.gz
Algorithm Hash digest
SHA256 53b4021a3416943d156aa64d30b4ac645e03f52bf9ec65b59f9c895c225d71d7
MD5 56bfb4afc08809fc0ca61d4e4fe31d38
BLAKE2b-256 a75a2cdebfca1597825054e0a4d8875cdd8faf192da707640da8c6260bc5ef94

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenmoulds-3.0.1.tar.gz:

Publisher: 06-publish-pypi.yml on BramAlkema/TokenMoulds

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenmoulds-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: tokenmoulds-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 583.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tokenmoulds-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 51a588d6feb08f0c10907a3743c0cb119b07886f799a1ca521f94f7e0d71fd1f
MD5 3efdec4151e648e2d0385a731d1b3399
BLAKE2b-256 d3d2507e650f6a495776bd1b28222c707bef5614f7f68f58475daee0ad7f6ab2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenmoulds-3.0.1-py3-none-any.whl:

Publisher: 06-publish-pypi.yml on BramAlkema/TokenMoulds

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page