Skip to content

Commit b422576

Browse files
unified brand, dark logo, etc
(cherry picked from commit eac74d6)
1 parent f4084aa commit b422576

File tree

3 files changed

+139
-55
lines changed

3 files changed

+139
-55
lines changed

docs/authoring/brand.qmd

Lines changed: 105 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ Quarto will detect the presence of `_brand.yml` and automatically apply the bran
3636
You can create a `_brand.yml` file outside of a Quarto project (e.g. without a `_quarto.yml`).
3737
In this case, `_brand.yml` will automatically apply to documents in the same directory.
3838

39+
```{.yaml filename="_brand.yml"}
40+
color:
41+
background: "#eeeeee"
42+
```
43+
44+
3945
You can also set brand options in a document by specifying brand elements under the `brand` option:
4046

4147
```{.yaml filename="document.qmd"}
@@ -73,9 +79,59 @@ brand: brand/_brand.yml
7379

7480
Paths specified in `_brand.yml` are relative to the location of the brand file.
7581

76-
### Dark Brand
82+
### Light and Dark Colors
83+
84+
To specify colors for both light and dark modes using a single brand.yml file, specify any color in `color` or `typography` with an object containing the `light` and `dark` colors:
85+
86+
```{.yaml filename="_brand.yml"}
87+
color:
88+
background:
89+
light: "#ffffff"
90+
dark: "#333333"
91+
foreground:
92+
light: "#333333"
93+
dark: "#ffffff"
94+
typography:
95+
headings:
96+
color:
97+
light: "#111144"
98+
dark: "#d0d0ff"
99+
```
100+
101+
This also works with the brand specified directly in the document metadata:
77102

78-
As with [Themes](/docs/output-formats/html-themes.qmd#dark-mode), you can specify both light and dark brands, making both a light and a dark version of your output available:
103+
104+
```{.yaml filename="document.qmd"}
105+
---
106+
brand:
107+
color:
108+
background:
109+
light: "#ffffff"
110+
dark: "#333333"
111+
foreground:
112+
light: "#333333"
113+
dark: "#ffffff"
114+
typography:
115+
headings:
116+
color:
117+
light: "#111144"
118+
dark: "#d0d0ff"
119+
---
120+
```
121+
122+
123+
::: {.callout-warning}
124+
125+
## Limitation
126+
127+
Colors in [the `palette`](#color) cannot currently be specified with `light` and `dark` variants.
128+
129+
:::
130+
131+
132+
### Light and Dark Brands
133+
134+
If you prefer to author separate light and dark brands for light and dark mode, or you need to customize non-color properties, you can separate the brands into their own files, and specify `light` and `dark` brand files:
79135

80136
```{.yaml filename="document.qmd"}
81137
---
@@ -85,6 +141,8 @@ brand:
85141
---
86142
```
87143

144+
This is similar to how [Themes](/docs/output-formats/html-themes.qmd#dark-mode) work.
145+
88146
This also works with brands specified directly in the document:
89147

90148
```{.yaml filename="document.qmd"}
@@ -109,19 +167,23 @@ brand:
109167
dark: dark-brand.yml
110168
```
111169

112-
113170
::: {.callout-warning}
114171

115172
## Limitation
116173

117-
The `revealjs` format does not support switching between light and dark modes.
174+
Brand metadata cannot currently be specified directly in `_quarto.yml`, only via the file syntax.
118175

119-
:::
176+
:::
120177

121178

122-
#### Typst
123179

124-
To choose a dark brand in Typst output use `brand-mode: dark`:
180+
### Brand Mode
181+
182+
The Typst and revealjs formats do not produce outputs which can toggle between light and dark mode dynamically.
183+
184+
Setting `brand-mode: dark` will cause either format to render using the dark brand.
185+
186+
Typst:
125187

126188
```{.yaml filename="document.qmd"}
127189
---
@@ -131,6 +193,16 @@ format:
131193
---
132194
```
133195

196+
Revealjs:
197+
198+
```{.yaml filename="document.qmd"}
199+
---
200+
format:
201+
revealjs:
202+
brand-mode: dark
203+
---
204+
```
205+
134206

135207
## Brand Elements
136208

@@ -257,15 +329,7 @@ logo:
257329
path: https://quarto.org/quarto.png
258330
alt: "Quarto icon"
259331
small: quarto-logo
260-
```
261-
262-
::: {.callout-warning}
263-
264-
## Limitation
265-
266-
The **brand.yml** specification allows you to specify a `light` and `dark` version of your logo, but Quarto currently only uses the `light` version.
267-
268-
:::
332+
```
269333

270334
#### Document logo customization
271335

@@ -278,7 +342,15 @@ logo: large
278342
---
279343
```
280344

281-
Or, specify a brand logo and change the alt text:
345+
Or override the brand logo for this document with a logo from a file:
346+
347+
```{.yaml filename="document.qmd"}
348+
---
349+
logo: logo.png
350+
---
351+
```
352+
353+
Or specify a brand logo resource and change the alt text:
282354

283355
```{.yaml filename="document.qmd"}
284356
---
@@ -288,6 +360,21 @@ logo:
288360
---
289361
```
290362

363+
You can also individually customize light and dark logos, with any of the variations shown above:
364+
365+
```{.yaml filename="document.qmd"}
366+
---
367+
logo:
368+
light:
369+
path: large
370+
alt: Alternate alternate text
371+
dark:
372+
path: dark-logo.png
373+
alt: Alternate text for dark logo
374+
---
375+
```
376+
377+
291378
::: {.callout-warning}
292379

293380
## Limitation
@@ -296,35 +383,7 @@ It is [not currently possible](https://github.com/quarto-dev/quarto-cli/issues/1
296383

297384
:::
298385

299-
The Typst implementation allows customization of the logo position at the document level:
300-
301-
```{.yaml filename="document.qmd"}
302-
---
303-
format:
304-
typst:
305-
logo:
306-
width: 1in
307-
location: right-top
308-
padding-right: 0.5in
309-
padding-top: 0.25in
310-
alt: Alternate alternate text
311-
---
312-
```
313-
314-
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
315-
| Option | Description |
316-
+==========================+================================================================================================================================================+
317-
| `width` | Width in CSS units. Default `1.5in`. |
318-
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
319-
| `location` | Location on the page in `X-Y`, where `X` is `left`, `center`, or `right` and Y is `top`, `middle`, or `bottom`. |
320-
| | Applied as Typst [`align`](https://typst.app/docs/reference/layout/align/). |
321-
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
322-
| `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.|
323-
| `padding-right`, | Padding options are applied in alphabetical order. |
324-
| `padding-bottom`, | Applied as Typst [`block.inset`](https://typst.app/docs/reference/layout/block/#parameters-inset). |
325-
| `padding-left` | Default `padding: 0.75in`. |
326-
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
327-
386+
The Typst implementation allows [customization of the logo position](../output-formats/typst.qmd#logo-position).
328387

329388
### Typography
330389

@@ -342,13 +401,6 @@ typography:
342401
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).
343402

344403

345-
::: {.callout-warning}
346-
## Limitation
347-
348-
HTML formats do not currently support `source: file`.
349-
:::
350-
351-
352404
You can then refer to fonts by `family` in the remaining typography options:
353405

354406
``` {.yaml filename="_brand.yml"}

docs/extensions/metadata.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Currently, metadata extensions only merge project-level metadata. This limitatio
1414

1515
Here we'll describe how to create a simple metadata extension. We'll use the `quarto create` command to do this. If you are using VS Code, Positron, or RStudio you should execute `quarto create` within their respective integrated Terminal panes.
1616

17-
To get started, execute `quarto create extension metadata` within the parent directory where you'd like the filter extension to be created:
17+
To get started, execute `quarto create extension metadata` within the parent directory where you'd like the metadata extension to be created:
1818

1919
```{.bash filename="Terminal"}
2020
$ quarto create extension metadata
2121
? Extension Name › my-prerender-scripts
2222
```
2323

24-
As shown above, you'll be prompted for an extension name. Type `my-prerender-scripts` and press Enter---the filter extension is then created:
24+
As shown above, you'll be prompted for an extension name. Type `my-prerender-scripts` and press Enter---the metadata extension is then created:
2525

2626
```bash
2727
? Extension Name › my-prerender-scripts

docs/output-formats/typst.qmd

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,38 @@ fontsize: 11pt
288288
---
289289
```
290290

291+
## Logo Position
292+
293+
If there is a logo [from brand.yml](../authoring/brand.qmd#logo) or specified directly in the document, Quarto's Typst implementation allows customization of the logo position in the document (or project):
294+
295+
```{.yaml filename="document.qmd"}
296+
---
297+
format:
298+
typst:
299+
logo:
300+
width: 1in
301+
location: right-top
302+
padding-right: 0.5in
303+
padding-top: 0.25in
304+
alt: Alternate alternate text
305+
---
306+
```
307+
308+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
309+
| Option | Description |
310+
+==========================+================================================================================================================================================+
311+
| `width` | Width in CSS units. Default `1.5in`. |
312+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
313+
| `location` | Location on the page in `X-Y`, where `X` is `left`, `center`, or `right` and Y is `top`, `middle`, or `bottom`. |
314+
| | Applied as Typst [`align`](https://typst.app/docs/reference/layout/align/). |
315+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
316+
| `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.|
317+
| `padding-right`, | Padding options are applied in alphabetical order. |
318+
| `padding-bottom`, | Applied as Typst [`block.inset`](https://typst.app/docs/reference/layout/block/#parameters-inset). |
319+
| `padding-left` | Default `padding: 0.75in`. |
320+
+--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
321+
322+
291323
## Computation Figure Format
292324

293325
Typst has great support for SVG graphics, so `format: typst` defaults to `fig-format: svg`. This configuration means executable code cells that produce images will produce `.svg` output.

0 commit comments

Comments
 (0)