Multiformat branding with _brand.yml

Overview

Quarto supports brand.yml—a single YAML file that can be used to customize the appearance of your documents across multiple formats. This is particularly useful for organizations that need a unified look across various formats.

As an example, consider the following _brand.yml file:

_brand.yml
color:
  palette:
    dark-grey: "#222222"
    blue: "#ddeaf1"
  background: blue
  foreground: dark-grey
  primary: black

logo: 
  medium: logo.png

typography:
  fonts:
    - family: Jura
      source: google
  base: Jura
  headings: Jura

When this _brand.yml is placed in a project, webpages, presentations, PDF reports, and dashboards will share a common appearance:

Screenshot of a webpage. The text is dark grey on a light blue background, using a rounded sans-serif typeface, a logo appears in the navbar.

Webpage: html

Screenshot of a dashboard. The text is dark grey on a light blue background, using a rounded sans-serif typeface, a logo appears in the navbar.

Dashboard dashboard

Screenshot of a presentation. The text is dark grey on a light blue background, using a rounded sans-serif typeface, a logo appears in bottom left of the slide.

Presentation: revealjs

Screenshot of a PDF document. The text is dark grey on a light blue background, using a rounded sans-serif typeface, a logo appears in top right of the page.

PDF: typst

View the example: Source | Live website

On this page:

  • Learn how to add a brand file.

  • Learn about the elements of brand.yml and how they are used in Quarto.

  • Learn how to access brand values outside of the brand file.

  • See a more comprehensive example.

Limitation

The brand.yml specification is an active area of work at Posit. Quarto’s support for brand.yml is not yet complete. For now, we’ve highlighted places where Quarto doesn’t yet support the full spec with special Limitation callouts, like this one.

Currently, the formats that support brand.yml are: html, dashboard, revealjs and typst.

Applying Brand

To specify a brand, create a _brand.yml file in the root directory of your project (i.e. alongside _quarto.yml). Quarto will detect the presence of _brand.yml and automatically apply the brand to all documents of the supported formats in the project.

You can create a _brand.yml file outside of a Quarto project (e.g. without a _quarto.yml). In this case, _brand.yml will automatically apply to documents in the same directory.

You can also set brand options in a document by specifying brand elements under the brand option:

document.qmd
---
brand:
  color:
    background: "#eeeeee"
---

If you set brand in a document header, it will replace the entire brand from _brand.yml.

You can disable brand for a document by setting brand to false:

document.qmd
---
brand: false
---

You can put _brand.yml in a subdirectory of your project, and then use the brand key to specify the path to the brand file. For example, to use the brand file at brand/_brand.yml for a single document, add brand to the header:

document.qmd
---
brand: brand/_brand.yml
---

To use the brand file at brand/_brand.yml for all documents in the project add brand to _quarto.yml:

_quarto.yml
brand: brand/_brand.yml

Paths specified in _brand.yml are relative to the location of the brand file.

Brand Elements

The elements of brand.yml are specified in the documentation for the brand.yml project. In this section, learn how these elements are used in Quarto.

Color

Color in the brand.yml docs

Use color to define your brand’s color palette and map your palette to the roles colors play, a.k.a semantic colors. A simple example might define the value background to a light blue:

_brand.yml
color:
  background: "#ddeaf1"

Use the palette key to define a set of named colors that can be referenced elsewhere in the _brand.yml. For example, you might define blue and set it as the background:

_brand.yml
color:
  palette:
    blue: "#ddeaf1"
  background: blue

The most commonly used semantic colors include foreground, background and primary:

_brand.yml
color:
  palette:
    dark-grey: "#222222"
    blue: "#ddeaf1"
  background: blue
  foreground: dark-grey
  primary: black

The colors foreground and background are used consistently across formats to set the color of the main text and color of the page it appears on. The color primary sets the link color, navbar color (html and dashboard), and progress bar color (revealjs).

For HTML formats that use Bootstrap (html, dashboard) the remaining semantic colors are mapped directly to their Bootstrap counterparts with the same name.

The full list of semantic colors you can set in color is:

Name Description
foreground The main text color. Typically will be close to black and must have high contrast with the background color.
background The main background color. Tyically will be close to white and must have high contrast with the foreground color.
primary The primary accent color, used for hyperlinks, active states, and primary action buttons.
secondary The secondary accent color, often used for lighter text or disabled states.
tertiary The tertiary accent color, used for hover states, accents, and wells.
success The color used for positive or successful actions and information.
info The color used for neutral or informational actions and information.
warning The color used for warning or cautionary actions and information.
danger The color used for errors, dangerous actions, or negative information.
light A bright color, used as a high-contrast foreground color on dark elements or low-contrast background color on light elements.
dark A dark color, used as a high-contrast foreground color on light elements or high-contrast background color on light elements.

You can access both named and semantic colors from your brand in SCSS and using the brand shortcode. See Using _brand.yml values for more details.