Skip to content

Commit 147192e

Browse files
typst brand yml: move logo documentation out of advanced
and clean up fixes quarto-dev/quarto-cli#12181
1 parent 2871f29 commit 147192e

2 files changed

Lines changed: 69 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: 69 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}
@@ -521,14 +578,6 @@ You can learn more about layering themes in [More About Quarto Themes](/docs/out
521578

522579
### Typst
523580

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-
532581
In Typst documents, brand colors are set in a [dictionary](https://typst.app/docs/reference/foundations/dictionary/) called `brand-color`.
533582
You can access them directory in raw Typst blocks using the syntax `brand-color.COLOR_NAME`.
534583
For example, you could make a rectangle filled with your `primary` brand color:
@@ -607,4 +656,15 @@ theme:
607656
- brand
608657
```
609658
610-
Learn more about how Quarto generates styles in [More About Quarto Themes](/docs/output-formats/html-themes-more.qmd).
659+
Learn more about how Quarto generates styles in [More About Quarto Themes](/docs/output-formats/html-themes-more.qmd).
660+
661+
## Choosing light or dark brand in Typst
662+
663+
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.
664+
665+
``` yaml
666+
format:
667+
typst:
668+
brand-mode: dark
669+
```
670+

0 commit comments

Comments
 (0)