Skip to content

Commit 5bbc060

Browse files
authored
add thumbnail with styling for light and dark mode (typst-community#27)
* add thumbnail with styling for light and dark mode * replace thumbnails with SVG
1 parent 85d4380 commit 5bbc060

File tree

6 files changed

+217
-0
lines changed

6 files changed

+217
-0
lines changed

Justfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ default:
99
# generate manual
1010
doc:
1111
typst compile docs/manual.typ docs/manual.pdf
12+
typst compile docs/thumbnail.typ thumbnail-light.svg
13+
typst compile --input theme=dark docs/thumbnail.typ thumbnail-dark.svg
1214

1315
# run test suite
1416
test *args:

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ These instructions will get you a copy of the project up and running on the typs
3636
#my-func()
3737
```
3838

39+
<picture>
40+
<source media="(prefers-color-scheme: dark)" srcset="./thumbnail-dark.svg">
41+
<img src="./thumbnail-light.svg">
42+
</picture>
43+
3944
### Installation
4045

4146
A step by step guide that will tell you how to get the development environment up and running. This should explain how to clone the repo and where to (maybe a link to the typst documentation on it), along with any pre-requisite software and installation steps.

docs/thumbnail.typ

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#import "/src/lib.typ" as my-package: *
2+
3+
#set page(height: auto, margin: 5mm, fill: none)
4+
5+
// style thumbnail for light and dark theme
6+
#let theme = sys.inputs.at("theme", default: "light")
7+
#set text(white) if theme == "dark"
8+
9+
#set text(22pt)
10+
#align(center)[_a thumbnail showing the package's output_]

0 commit comments

Comments
 (0)