You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/authoring/brand.qmd
+81-49Lines changed: 81 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,6 @@
2
2
title: Multiformat branding with `_brand.yml`
3
3
---
4
4
5
-
::: callout-caution
6
-
## Work In Progress
7
-
8
-
These docs are a work-in-progress and may be incorrect or incomplete. Feedback welcome.
9
-
:::
10
-
11
5
## Overview
12
6
13
7
Quarto supports [**brand.yml**](https://posit-dev.github.io/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.
@@ -102,7 +96,7 @@ color:
102
96
background: blue
103
97
```
104
98
105
-
The most commonly used colors include `foreground`, `background` and `primary`:
99
+
The most commonly used semantic colors include `foreground`, `background` and `primary`:
106
100
107
101
```{.yaml filename="_brand.yml"}
108
102
color:
@@ -166,7 +160,15 @@ logo:
166
160
medium: logo.png
167
161
```
168
162
169
-
You can specify a local file path, relative to the location of `_brand.yml`, or a URL (*is this true?*).
163
+
You can specify a local file path, relative to the location of `_brand.yml`, or a URL.
164
+
165
+
::: {.callout-warning}
166
+
167
+
## Limitation
168
+
169
+
Logos specified as URLs are not currently supported in `format: typst`.
170
+
171
+
:::
170
172
171
173
A single logo may not work well in all locations so **brand.yml** allows you to set three different logos: `small`, `medium` and `large`. For example:
172
174
@@ -223,7 +225,7 @@ typography:
223
225
source: google
224
226
```
225
227
226
-
The properties you can set for a font under `fonts` depends on the `source`. You can see the other properties available in our [Reference for Brand](docs/reference/metadata/brand.qmd#font-resource-definitions).
228
+
The properties you can set for a font under `fonts` depends on the `source`. You can see the other properties available in our [Reference for Brand](/docs/reference/metadata/brand.qmd#font-resource-definitions).
227
229
228
230
You can then refer to fonts by `family` in the remaining typography options:
229
231
@@ -330,50 +332,51 @@ The supported fields are generally described as follows:
330
332
331
333
[Defaults in the **brand.yml** docs](https://posit-dev.github.io/brand-yml/brand/defaults.html){.external}
332
334
333
-
The `defaults` section of **brand.yml** allows users to set option for specific tools that don't otherwise fit into the **brand.yml** schema. In particular, Quarto currently supports `defaults: bootstrap`.
335
+
The `defaults` section of **brand.yml** allows users to set options for specific tools that don't otherwise fit into the **brand.yml** schema. Quarto's implementation currently supports `defaults: bootstrap`.
334
336
335
-
::: {.content-hidden}
337
+
#### Bootstrap
336
338
337
-
#### Quarto
339
+
The `bootstrap` section of `defaults` follows [**brand.yml**](https://posit-dev.github.io/brand-yml/brand/defaults.html) and applies to the `html` and `dashboard` formats.
340
+
Quarto merges the options set under `defaults: bootstrap` in the appropriate layer of [Quarto's SCSS layering system](/docs/output-formats/html-themes-more.qmd).
338
341
339
-
Quarto merges options you set in `defaults: quarto` with document metadata. For example, you can use this to set format specific options like syntax highlighting for `html`:
342
+
The `defaults` option inside `bootstrap`, can take a string, or key-value pairs
343
+
corresponding to SCSS variable name-value pairs.
344
+
Building on our initial example, you could use `bootstrap: defaults` to set the SCSS variables `link-decoration` and `navbar-fg`:
340
345
341
346
```{.yaml filename="_brand.yml"}
342
347
defaults:
343
-
quarto:
344
-
format:
345
-
html:
346
-
highlight-style: github
348
+
bootstrap:
349
+
defaults: # defaults also supports a string as its value
350
+
link-decoration: underline
351
+
navbar-fg: "#fff"
347
352
```
348
353
349
-
Or, you might change the `logo` options for `typst`:
354
+
The resulting HTML pages will have links that are underlined and use white for text in the navigation bar.
350
355
351
-
```{.yaml filename="_brand.yml"}
352
-
defaults:
353
-
quarto:
354
-
format:
355
-
typst:
356
-
logo:
357
-
location: left-bottom
358
-
```
359
-
360
-
::: callout-note
361
-
## Set all formats in document metadata
362
-
363
-
Because of the merging behavior of `format`, if you set format specific options in `defaults: quarto`, you'll need to set all the required formats in document metadata:
{.lightbox group="brand-bootstrap-defaults" fig-alt="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."}
370
359
:::
371
360
372
-
:::
361
+
::: {}
362
+
{.lightbox group="brand-bootstrap-defaults" fig-alt="Screenshot of a webpage. It looks identical to the previous image, except for underlined links and white text on the navbar."}
363
+
:::
364
+
:::::::
373
365
374
-
#### Bootstrap
366
+
In addition to the `defaults` option, Quarto supports `uses`, `functions`, `mixins` and `rules`, which all take a string value.
367
+
For example, you could use `rules` to provide a CSS rule to remove the border below second-level headings:
375
368
376
-
*How relevant is `defaults: bootstrap`? Example? WHere do you find out what you can put under `bootstrap`?*
369
+
```{.yaml filename="_brand.yml"}
370
+
defaults:
371
+
bootstrap:
372
+
# uses: <string>
373
+
# functions: <string>
374
+
# mixins: <string>
375
+
rules: |
376
+
h2 {
377
+
border: none;
378
+
}
379
+
```
377
380
378
381
### Meta
379
382
@@ -438,21 +441,54 @@ You can't currently access `typography`, `meta`, or `defaults` values using the
438
441
439
442
### In SCSS
440
443
441
-
If `_brand.yml` defines `color: blue`:
444
+
The colors defined in `palette` are set as SCSS variables of the form `brand-COLOR_NAME`.
445
+
For example, if `_brand.yml` defines `blue`:
442
446
443
447
```{.yaml filename="_brand.yml"}
444
448
color:
445
449
palette:
446
450
blue: "#ddeaf1"
447
451
```
448
452
449
-
This should work:
453
+
Then the variable `$brand-blue` is will be set to `#ddeaf1` in the `defaults` layer of [Quarto's SCSS layering system](/docs/output-formats/html-themes-more.html#bootstrap-bootswatch-layering).
454
+
You can add a custom SCSS file, `styles.scss`, in the usual way:
455
+
```{.yaml filename="_quarto.yml"}
456
+
format:
457
+
html:
458
+
theme: [styles.scss]
459
+
```
460
+
461
+
Then `styles.scss` can use these brand variables to make style tweaks.
462
+
For example, you might want all `h1` elements to be `blue`:
463
+
464
+
```{.scss filename="styles.scss"}
465
+
/*-- scss:rules --*/
466
+
467
+
h1 {
468
+
color: $brand-blue;
469
+
}
470
+
```
471
+
472
+
When you specify SCSS files without an explicit `brand` element, it is equivalent to listing them after `brand`.
473
+
For instance, the above `theme` is equivalent to:
450
474
451
-
```{.scss filename="custom.scss"}
452
-
/*-- scss:defaults --*/
453
-
$navbar-bg: $brand-blue;
475
+
```{.yaml filename="_quarto.yml"}
476
+
format:
477
+
html:
478
+
theme: [brand, styles.scss]
479
+
```
480
+
481
+
The order of elements in `theme` controls their priority.
482
+
For example, you could layer brand and your custom SCSS on top of a built-in theme:
483
+
484
+
```{.yaml filename="_quarto.yml"}
485
+
format:
486
+
html:
487
+
theme: [cosmo, brand, styles.scss]
454
488
```
455
489
490
+
You can learn more about layering themes in [More About Quarto Themes](/docs/output-formats/html-themes-more.qmd).
491
+
456
492
### Typst
457
493
458
494
In Typst documents, brand colors are set in a [dictionary](https://typst.app/docs/reference/foundations/dictionary/) called `brand-color`.
@@ -474,7 +510,3 @@ Filters and shortcodes can access brand values using the `brand` Lua module.
Copy file name to clipboardExpand all lines: docs/output-formats/html-themes-more.qmd
+48-1Lines changed: 48 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ From time to time, as the Bootswatch themes are updated, we will update these me
44
44
45
45
## Bootstrap / Bootswatch Layering
46
46
47
-
When using the Quarto HTML format, we allow the user to specify theme information in the document front matter (or project YAML). The theme information consists of a list of one or more of
47
+
When using the Quarto `html` and `dashboard` formats, we allow the user to specify theme information in the document front matter (or project YAML). The theme information consists of a list of one or more of
48
48
49
49
- A valid built in Bootswatch theme name
50
50
@@ -106,3 +106,50 @@ We order the themes according to the order that they are specified in the YAML,
106
106
Bootstrap
107
107
cosmo /*-- scss:rules --*/
108
108
custom.scss /*-- scss:rules --*/
109
+
110
+
## `revealjs` Layering
111
+
112
+
The same system applies for `revealjs` and its themes.
113
+
`revealjs`themes shipped with Quarto do not have a uniform variable naming convention, and so different SCSS files are likely to be needed to make effective changes to different themes.
114
+
115
+
Nevertheless, the following examples illustrate what's possible:
116
+
117
+
``` yaml
118
+
# In this configuration, `custom.scss` takes precedence
119
+
format:
120
+
revealjs:
121
+
theme:
122
+
- blood
123
+
- custom.scss
124
+
# In this configuration, the `blood` theme takes precedence
125
+
format:
126
+
revealjs:
127
+
theme:
128
+
- custom.scss
129
+
- blood
130
+
```
131
+
132
+
## `_brand.yml` Layering
133
+
134
+
Quarto supports [**brand.yml**](https://posit-dev.github.io/brand-yml/brand/defaults.html), see the [Brand guide](/docs/authoring/brand.qmd) for more details.
135
+
By default, styling information in `_brand.yml` takes the lowest precedence.
136
+
To change this, use the `"brand"` string in your theme configuration in YAML:
137
+
138
+
``` yaml
139
+
# In this configuration, the `blood` theme takes precedence
140
+
# over `custom.scss` *and* the information in `_brand.yml`
141
+
format:
142
+
revealjs:
143
+
theme:
144
+
- custom.scss
145
+
- blood
146
+
# In this configuration, the information in `_brand.yml` takes
147
+
# precedence over the `blood` theme and `custom.scss`, in that
Copy file name to clipboardExpand all lines: docs/presentations/revealjs/themes.qmd
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -215,3 +215,4 @@ See these articles to learn more about using Reveal:
215
215
-[Reveal Basics](index.qmd) covers the basic mechanics of creating presentations.
216
216
-[Presenting Slides](presenting.qmd) describes slide navigation, printing to PDF, drawing on slides using a chalkboard, and creating multiplex presentations.
217
217
-[Advanced Reveal](advanced.qmd) delves into transitions, animations, advanced layout and positioning, and other options available for customizing presentations.
218
+
-[More About Quarto Themes](/docs/output-formats/html-themes-more.qmd) describes the layering system in more detail, including interactions with other SCSS files and [`_brand.yml`](/docs/authoring/brand.qmd).
0 commit comments