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
+47-4Lines changed: 47 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -442,19 +442,62 @@ You can't currently access `typography`, `meta`, or `defaults` values using the
442
442
443
443
### In SCSS
444
444
445
-
If `_brand.yml` defines `color: blue`:
445
+
The colors defined in `palette` are set as SCSS variables of the form `brand-COLOR_NAME`.
446
+
For example, if `_brand.yml` defines `blue`:
446
447
447
448
```{.yaml filename="_brand.yml"}
448
449
color:
449
450
palette:
450
451
blue: "#ddeaf1"
451
452
```
452
453
453
-
This should work:
454
+
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).
455
+
You can add a custom SCSS file, `styles.scss`, in the usual way:
456
+
```{.yaml filename="_quarto.yml"}
457
+
format:
458
+
html:
459
+
theme: [styles.scss]
460
+
```
454
461
455
-
```{.scss filename="custom.scss"}
462
+
Then `styles.scss` can use these brand variables to make style tweaks.
463
+
For example, you might want all `h1` elements to be `blue`:
464
+
465
+
```{.scss filename="styles.scss"}
466
+
/*-- scss:rules --*/
467
+
468
+
h1 {
469
+
color: $brand-blue;
470
+
}
471
+
```
472
+
473
+
When you specify SCSS files without an explicit `brand` element, it is equivalant to listing them after `brand`.
474
+
For instance, the above `theme` is equivalant to:
475
+
476
+
```{.yaml filename="_quarto.yml"}
477
+
format:
478
+
html:
479
+
theme: [brand, styles.scss]
480
+
```
481
+
482
+
This order doesn't matter when you are setting items in the `/*-- scss:rules --*/` layer, because `rules` are layered on after `defaults`.
483
+
484
+
However, if you want to set a [Quarto SASS variable](https://quarto.org/docs/output-formats/html-themes.html#sass-variables) you'll use the `/*-- scss:defaults --*/` layer and the order of items in `theme` will matter.
485
+
486
+
As an example, consider setting the navigation bar background to the `blue` brand color:
487
+
488
+
```{.scss filename="nav.scss"}
456
489
/*-- scss:defaults --*/
457
-
$navbar-bg: $brand-blue;
490
+
491
+
$navbar-bg: $brand-blue;
492
+
```
493
+
494
+
Because of the way Quarto layers SCSS, the order for the `defaults` layer is the reverse of what is specified in `theme`.
495
+
For `nav.scss` to find the `brand-blue` variable, `brand` must come after `nav.scss` in `theme`:
0 commit comments