Skip to content

Commit 05a53f2

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 270c663 commit 05a53f2

2 files changed

Lines changed: 74 additions & 34 deletions

File tree

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
@@ -242,6 +242,63 @@ The **brand.yml** specification allows you to specify a `light` and `dark` versi
242242

243243
:::
244244

245+
#### Document logo customization
246+
247+
The document `logo` option allows extra customization of the logo.
248+
249+
To choose a brand logo resource:
250+
```{.yaml filename="document.qmd"}
251+
---
252+
logo: large
253+
---
254+
```
255+
256+
To choose a brand logo resource and change the alt text:
257+
258+
```{.yaml filename="document.qmd"}
259+
---
260+
logo:
261+
path: large
262+
alt: Alternate alternate text
263+
---
264+
```
265+
266+
::: {.callout-warning}
267+
268+
## Limitation
269+
270+
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.
271+
272+
:::
273+
274+
The Typst implementation allows customization of the logo position at the document level:
275+
276+
```{.yaml filename="document.qmd"}
277+
---
278+
logo:
279+
width: 1in
280+
location: right-top
281+
padding-right: 0.5in
282+
padding-top: 0.25in
283+
alt: Alternate alternate text
284+
---
285+
```
286+
287+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
288+
| Option | Description |
289+
+==========================+================================================================================================================================================+
290+
| `width` | Width in CSS units. Default `1.5in`. |
291+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
292+
| `location` | Location on the page in `X-Y`, where `X` is `left`, `center`, or `right` and Y is `top`, `middle`, or `bottom`. |
293+
| | Applied as Typst [`align`](https://typst.app/docs/reference/layout/align/). |
294+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
295+
| `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.|
296+
| `padding-right`, | Padding options are applied in alphabetical order. |
297+
| `padding-bottom`, | Applied as Typst [`block.inset`](https://typst.app/docs/reference/layout/block/#parameters-inset). |
298+
| `padding-left` | Default `padding: 0.75in`. |
299+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
300+
301+
245302
### Typography
246303

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

359416
:::
360417

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

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

522584
### Typst
523585

524-
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.
525-
526-
``` yaml
527-
format:
528-
typst:
529-
brand-mode: dark
530-
```
531-
532586
In Typst documents, brand colors are set in a [dictionary](https://typst.app/docs/reference/foundations/dictionary/) called `brand-color`.
533587
You can access them directory in raw Typst blocks using the syntax `brand-color.COLOR_NAME`.
534588
For example, you could make a rectangle filled with your `primary` brand color:
@@ -605,4 +659,15 @@ theme:
605659
- brand
606660
```
607661
608-
Learn more about how Quarto generates styles in [More About Quarto Themes](/docs/output-formats/html-themes-more.qmd).
662+
Learn more about how Quarto generates styles in [More About Quarto Themes](/docs/output-formats/html-themes-more.qmd).
663+
664+
## Choosing light or dark brand in Typst
665+
666+
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.
667+
668+
``` yaml
669+
format:
670+
typst:
671+
brand-mode: dark
672+
```
673+

0 commit comments

Comments
 (0)