Skip to content

Commit 967bf92

Browse files
typst brand yml: move logo documentation out of advanced
add link to advanced typst brand yaml doc fixes quarto-dev/quarto-cli#12181
1 parent 899b480 commit 967bf92

File tree

2 files changed

+74
-34
lines changed

2 files changed

+74
-34
lines changed

docs/advanced/typst/brand-yaml.qmd

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,6 @@ Brand YAML palette and theme colors are available in Typst `brand-color`, e.g. `
1717

1818
Lighter versions of the colors, suitable as background colors, are available in `brand-background-color`, e.g. `brand-background-color.success`.
1919

20-
## Logo
21-
22-
The `logo` option allows extra customization in Typst for full control over layout.
23-
24-
In all formats, `logo` can be the path to a logo or the name of a `brand.logo` resource, i.e. `small`, `medium`, or `large`. It can also be an object with
25-
26-
`path`
27-
: Image path or name of `brand.logo` resource
28-
`alt`
29-
: Alt text for the logo image
30-
31-
The Typst implementation also supports
32-
33-
`width`
34-
: Width in CSS units. Default `1.5in`.
35-
36-
`location`
37-
: Location on the page in X and Y using CSS [`text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align) and [`text-vertical-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align) keyword values, specifically
38-
`left`, `center`, `right` and `top`, `middle`, and `bottom`.
39-
The X and Y components are combined with a dash, e.g. `left-top` (the default), `center-middle`, etc.
40-
Applied as Typst [`align`](https://typst.app/docs/reference/layout/align/).
41-
42-
`padding`, `padding-top`, `padding-right`, `padding-bottom`, `padding-left`
43-
: Amount of padding to add to each side of the logo, using CSS [`padding`](https://developer.mozilla.org/en-US/docs/Web/CSS/padding) conventions. Due to a limitation in the Lua implementation of YAML, multiple padding options are applied in alphabetical order instead of the order of the YAML object. Applied as Typst [`block.inset`](https://typst.app/docs/reference/layout/block/#parameters-inset). Default `padding: 0.75in`.
44-
4520
## Typography
4621

4722
Brand YAML is specified for the following elements and Brand YAML properties. Combinations that are not supported are marked NA.

docs/authoring/brand.qmd

Lines changed: 74 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,63 @@ The **brand.yml** specification allows you to specify a `light` and `dark` versi
244244

245245
:::
246246

247+
#### Document logo customization
248+
249+
The document `logo` option allows extra customization of the logo.
250+
251+
To choose a brand logo resource:
252+
```{.yaml filename="document.qmd"}
253+
---
254+
logo: large
255+
---
256+
```
257+
258+
To choose a brand logo resource and change the alt text:
259+
260+
```{.yaml filename="document.qmd"}
261+
---
262+
logo:
263+
path: large
264+
alt: Alternate alternate text
265+
---
266+
```
267+
268+
::: {.callout-warning}
269+
270+
## Limitation
271+
272+
It is [not currently possible](https://github.com/quarto-dev/quarto-cli/issues/11309) to customize the logo for a specific page within a website. Only the project's `_brand.yml` is applied.
273+
274+
:::
275+
276+
The Typst implementation allows customization of the logo position at the document level:
277+
278+
```{.yaml filename="document.qmd"}
279+
---
280+
logo:
281+
width: 1in
282+
location: right-top
283+
padding-right: 0.5in
284+
padding-top: 0.25in
285+
alt: Alternate alternate text
286+
---
287+
```
288+
289+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
290+
| Option | Description |
291+
+==========================+================================================================================================================================================+
292+
| `width` | Width in CSS units. Default `1.5in`. |
293+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
294+
| `location` | Location on the page in `X-Y`, where `X` is `left`, `center`, or `right` and Y is `top`, `middle`, or `bottom`. |
295+
| | Applied as Typst [`align`](https://typst.app/docs/reference/layout/align/). |
296+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
297+
| `padding`, `padding-top`,| Amount of padding to add to each side of the logo, using CSS [`padding`](https://developer.mozilla.org/en-US/docs/Web/CSS/padding) conventions.|
298+
| `padding-right`, | Padding options are applied in alphabetical order. |
299+
| `padding-bottom`, | Applied as Typst [`block.inset`](https://typst.app/docs/reference/layout/block/#parameters-inset). |
300+
| `padding-left` | Default `padding: 0.75in`. |
301+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
302+
303+
247304
### Typography
248305

249306
[Typography in the **brand.yml** docs](https://posit-dev.github.io/brand-yml/brand/typography.html){.external}
@@ -360,6 +417,11 @@ The supported fields are generally described as follows:
360417

361418
:::
362419

420+
#### Typst
421+
422+
See [the Advanced documentation](/docs/advanced/typst/brand-yaml.qmd#typography) for more details on the Typst implementation, and troubleshooting tips for fonts.
423+
424+
363425
### Defaults
364426

365427
[Defaults in the **brand.yml** docs](https://posit-dev.github.io/brand-yml/brand/defaults.html){.external}
@@ -523,14 +585,6 @@ You can learn more about layering themes in [More About Quarto Themes](/docs/out
523585

524586
### Typst
525587

526-
If the document has [both light and dark brands](#dark-brand), use `brand-mode: dark` to produce a dark-background PDF that matches the dark brand of your website.
527-
528-
``` yaml
529-
format:
530-
typst:
531-
brand-mode: dark
532-
```
533-
534588
In Typst documents, brand colors are set in a [dictionary](https://typst.app/docs/reference/foundations/dictionary/) called `brand-color`.
535589
You can access them directory in raw Typst blocks using the syntax `brand-color.COLOR_NAME`.
536590
For example, you could make a rectangle filled with your `primary` brand color:
@@ -607,4 +661,15 @@ theme:
607661
- brand
608662
```
609663
610-
Learn more about how Quarto generates styles in [More About Quarto Themes](/docs/output-formats/html-themes-more.qmd).
664+
Learn more about how Quarto generates styles in [More About Quarto Themes](/docs/output-formats/html-themes-more.qmd).
665+
666+
## Choosing light or dark brand in Typst
667+
668+
If the document has [both light and dark brands](#dark-brand), use `brand-mode: dark` to produce a dark-background PDF that matches the dark brand of your website.
669+
670+
``` yaml
671+
format:
672+
typst:
673+
brand-mode: dark
674+
```
675+

0 commit comments

Comments
 (0)