05:00
Quarto includes 25 themes from the Bootswatch project:
Provide the custom theme under theme in the YAML heading:

Create reports, apps, dashboards, plots and more that match your company’s brand guidelines with a single _brand.yml file.
meta: Identifying information, name of the company, URLs, etc.logo: Files or links to the brand’s logos.color: Colors in the brand’s color palette.typography: Fonts for different elements.defaults: Additional context-specific settings._brand.yml structure_brand.yml
meta:
name: Example Company
link:
github: https://github.com/example-company
logo:
medium: logos/logo.png
color:
palette:
black: "#1C2826"
blue: "#0C0A3E"
neutral: "#F9F7F1"
red: "#BA274A"
violet: "#4D6CFA"
background: neutral
foreground: black
primary: blue
secondary: violet
danger: red
typography:
fonts:
- family: Nunito Sans
source: google
- family: Montserrat
source: google
- family: Fira Code
source: google
base: Nunito Sans
headings:
family: Montserrat
weight: 700
color: primary
monospace: Fira Code
link:
color: danger
decoration: underline_brand.yml file._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 now specify a light and dark brand for documents. For example, at a project-level you can provide two brand files:
(Note: this is not available in reveal.js).
You can use renderings to provide light and dark versions of a plot:
my-document.qmd
---
format:
html:
theme:
light: cosmo
dark: darkly
---
```{python}
#| renderings: [light, dark]
(ggplot(purpose_data, aes(x='reorder(primary_purpose, n)', y='n')) +
geom_col(fill='forestgreen', alpha=0.8) +
geom_text(aes(label='label'), ha='left', size=8) +
coord_flip() +
scale_y_continuous(labels=lambda x: [f"{int(i/1000)}k" if i >= 1000 else str(int(i)) for i in x]) +
labs(title="Recreation Dominates American Dam Purposes",
subtitle="Top 10 primary purposes for the nation's 92,428 dams",
x="Primary Purpose",
y="Number of Dams",
caption="Source: National Inventory of Dams") +
theme_dam)
```In the workshop repo, there is a file called 04-exercise.yml. Rename the file to _brand.yml and rerender your Quarto document.
Change some of the variables in the _brand.yml file and rerender to see how your theme changes.
05:00