Session 5
Friday, the 10th of April, 2026
brand.yml for cross-format consistency.brand.yml R and Python packages in code outputs.quarto use brand
brand.yml as a Quarto extension for organisational reuse.quarto use brand.brand.yml for cross-format consistency.brand.yml R and Python packages in code outputs.quarto use brand
brand.yml as a Quarto extension for organisational reuse.quarto use brand.This session explores Quarto’s branding capabilities, focusing on brand.yml as the central tool for unified branding across formats, the brand.yml R and Python packages for applying brand guidelines in code outputs, packaging brand configurations as extensions, and importing them with quarto use brand.
By the end of this session, participants will be able to:
brand.yml.brand.yml R and Python packages to apply brand guidelines in code outputs.quarto use brand.Quarto HTML format uses Bootstrap 5, providing:
Available themes: default, cerulean, cosmo, cyborg, darkly, flatly, journal, litera, lumen, lux, materia, minty, morph, pulse, quartz, sandstone, simplex, sketchy, slate, solar, spacelab, superhero, united, vapor, yeti, zephyr.
See HTML Theming for more.
See HTML Theming and More About Quarto Themes for YAML options and SCSS customisation.
Tip
For most branding needs, brand.yml provides a simpler and more portable approach than custom SCSS, as we will see next.
brand.yml Foundationbrand.yml is a single YAML file that codifies your organisation’s brand guidelines into a machine-readable format. It is used by Quarto, Shiny, and the brand.yml R and Python packages to create branded outputs across multiple formats and tools.
Key benefits:
brand.yml StructureCreate a _brand.yml file in your project root:
_brand.yml
meta:
name: "Your Organisation"
link: "https://yourorg.com"
color:
palette:
primary: "#2E86AB"
secondary: "#A23B72"
light: "#F8F9FA"
dark: "#343A40"
primary: primary
foreground: dark
background: light
logo:
small: "assets/logo-small.png"
medium: "assets/logo-medium.png"
large: "assets/logo-large.png"
typography:
fonts:
- family: "Inter"
source: "google"
base: "Inter"
headings: "Inter"The palette defines named colours that can be referenced throughout your brand:
_brand.yml
Cross-format usage:
$brand-primary (SCSS), --brand-primary (CSS), etc.brand-color.primary, etc.brand.yml packages for plots, tables, and applications.Define your organisation’s font system:
yaml
typography:
fonts:
# Google Fonts (automatically loaded)
- family: "Inter"
source: "google"
weight: [300, 400, 500, 600, 700]
# System fonts (fallback)
- family: "system-ui"
source: "system"
# Font assignments
base: "Inter" # Body text
headings: "Inter" # All headings
monospace: "SF Mono" # Code blocksSee Typst Brand YAML for troubleshooting fonts in Typst.
Provide logos at different sizes for various contexts:
| Format | Location | Logo Preference (high to low) |
|---|---|---|
html/dashboard |
Top navigation bar | small > medium > large |
html |
Side navigation | medium > small > large |
typst |
Top left, control with format: typst: logo |
medium > small > large |
revealjs |
Bottom right corner of slides | medium > small > large |
website/book project |
favicon shown in browser tab |
small |
See Logo Configuration for more.
| Format | Location | Logo Preference (high to low) |
|---|---|---|
html/dashboard |
Top navigation bar | small > medium > large |
html |
Side navigation | medium > small > large |
typst |
Top left, control with format: typst: logo |
medium > small > large |
revealjs |
Bottom right corner of slides | medium > small > large |
website/book project |
favicon shown in browser tab |
small |
See Logo Configuration for more.
Combine brand.yml with Bootstrap customisation:
brand.yml or SCSS for component customisation.
Note
The brand colours become available as CSS variables and SCSS variables automatically.
brand.yml in R and Pythonbrand.yml is not limited to document theming. The R and Python packages let you apply brand colours, fonts, and logos directly in your code outputs.
Supported integrations:
See brand.yml for full documentation.
brand.yml in RRead the brand and access its properties:
brand_yml in PythonRead the brand and access its properties:
Apply to a plotnine visualisation:
Note
The brand.yml packages ensure that your data visualisations match your document branding without manual colour copying.
Objective: Create a _brand.yml file from scratch with a colour palette, typography, logos, and test it across multiple output formats.
Create a new Quarto project:
Create a _brand.yml file with:
meta: Organisation name and link.color: A palette with at least primary, secondary, foreground, and background colours, plus semantic mappings.typography: One or two Google Fonts for base and headings.logo: References to logo files (add placeholder images to an assets/ directory).Add brand to your theme in _quarto.yml:
Add content to your index.qmd with headings, text, code blocks, and lists.
Render and verify branding in HTML:
Test in RevealJS:
Verify that colours, fonts, and logo appear consistently across both formats.
Add a code block (R or Python) that uses brand colours from _brand.yml in a plot.
Verify that the plot colours match the document branding.
_brand.yml with colour palette, typography, and logo.Brand extensions are Quarto extensions that provide a brand.yml file and its assets, packaged for easy distribution and reuse.
Key features:
quarto use brand for easy adoption._extensions/my-brand/brand.yml
meta:
name: "My Organisation"
link: "https://myorg.com"
color:
palette:
# Primary brand colours
brand-blue: "#2E86AB"
brand-coral: "#A23B72"
brand-gold: "#F4A261"
# Supporting colours
neutral-light: "#F8F9FA"
neutral-dark: "#343A40"
success-green: "#28A745"
warning-amber: "#FFC107"
# Semantic mappings
primary: brand-blue
secondary: brand-coral
success: success-green
warning: warning-amber
foreground: neutral-dark
background: neutral-light
logo:
small: assets/logo/favicon.png
medium: assets/logo/logo-horizontal.png
large: assets/logo/logo-vertical.png
typography:
fonts:
- family: "Source Sans Pro"
source: "google"
weight: [300, 400, 600, 700]
base: "Source Sans Pro"_extensions/my-brand/brand.yml
defaults:
bootstrap:
defaults:
# Enhanced navigation
navbar-padding-y: 1rem
navbar-brand-font-size: 1.5rem
# Improved buttons
btn-padding-y: 0.5rem
btn-padding-x: 1.5rem
btn-font-weight: 600
# Better spacing
spacer: 1rem
rules: |
/* Professional enhancements */
.navbar-brand {
font-weight: 700;
}
.btn-primary {
border-radius: 2rem;
transition: all 0.3s ease;
}
.btn-primary:hover {
transform: translateY(-1px);
}
/* Content styling */
.title-block-header {
padding: 3rem 2rem;
margin-bottom: 2rem;
border-radius: 0.5rem;
}Organise brand assets:
example.qmd
---
title: "Brand Extension Showcase"
subtitle: "Demonstrating consistent branding"
author: "Your Name"
format:
html:
theme:
- quartz
- brand
---
# Welcome to Our Brand System
This document demonstrates the power of brand extensions in Quarto.
[Primary Action]{.btn .btn-primary}
[Secondary Action]{.btn .btn-secondary}Important
Brand extensions require a _quarto.yml project file to work.
quarto use brandThe quarto use brand command copies brand files from an external source into your project’s _brand/ directory, making it easy to adopt shared organisational branding.
Supported sources:
quarto use brand ./path/to/brand.quarto use brand myorg/shared-brand.quarto use brand https://example.com/brand.zip.quarto use brand WorksThe command follows a structured workflow with user confirmations:
_brand/ directory if needed._brand/.Note
The result ensures your _brand/ directory matches the source exactly, making it easy to stay synchronised as shared brands evolve.
Skip all confirmation prompts for automated or CI workflows:
Tip
Use --dry-run first to review what will change, then --force in CI pipelines. See Brand for complete documentation.
Objective: Create a comprehensive brand extension that demonstrates unified branding across formats using brand.yml and light CSS customisation.
Example Code:
Generate extension scaffold:
Define your brand identity.
Add styling.
Build test project:
Test across formats:
Verify brand consistency.
✅ You’ve successfully completed the exercise if you can:
brand.yml and light (S)CSS.Quarto uses Pandoc’s templating system to generate output.
Key concepts:
$variable$ inserts YAML metadata.$if(variable)$...$endif$ for optional content.$for(variable)$...$endfor$ for repeated content.See Pandoc Template Syntax for complete documentation.
Variables from YAML front matter are inserted using $variable$:
Tip
Use $variable$ in any template file (.typ, .tex, .html, etc.).
See Article Templates for templates and partials.
Show content only when a variable exists:
Note
Use $if(variable)$...$else$...$endif$ for alternative content.
Important
$if(variable)$ in Pandoc templates checks if a variable is:
Process lists from YAML metadata:
Note
Use $it$ to reference the current item in a loop. Use $sep$ followed by the separator string for separators.
Add separators between items:
Objective: Modify a partial template to display additional metadata using Pandoc templating syntax.
Example Code:
Retrieve the partials described in Article Templates
Modify the title slide partial from Reveal.js to underline the corresponding author:
$if(by-author)$ to check for by-author metadata.by-author to find the corresponding author and underline their name.Add additional metadata to the title slide, such as affiliations or ORCID IDs.
Test the changes by rendering a sample presentation with multiple authors with affiliations and a corresponding author.
✅ You’ve successfully completed the exercise if you can:
Note
This section is optional supplementary material. It covers Typst customisation for participants interested in advanced PDF output.
Typst is a modern typesetting system for creating beautiful PDFs, designed to be simpler than LaTeX.
Why Typst?
See Typst Basics for more.
Quarto’s Typst templates use two key files:
typst-template.typ - Defines document layout:typst-template.typ
typst-show.typ - Captures YAML metadata using Pandoc syntax:typst-show.typ
by-author to get Quarto’s extended author metadata.
Note
Notice the Pandoc template syntax: $if()$, $for()$, $variable$.
typst-template.typ
brand.ymltypst-show.typ
Objective: Create a custom format extension that bundles brand.yml and styling into a reusable format for your organisation.
Example Code:
Generate format extension scaffold:
Add brand.yml and configure extension in _extension.yml:
Define your template in typst-template.typ and typst-show.typ.
Use your format in template.qmd:
Render and verify:
Add HTML output to your format:
Add HTML format to _extension.yml.
Create/Modify simple template. (See HTML partials)
Test both formats:
✅ You’ve successfully completed the exercise if you can: