Skip to content

Commit 5037a61

Browse files
authored
touying-matcha:0.1.0 (#5147)
1 parent 4f7f2eb commit 5037a61

6 files changed

Lines changed: 258 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 songwupei
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# touying-matcha
2+
3+
A fresh, matcha-green theme for the [Touying](https://github.com/touying-typ/touying) presentation framework.
4+
5+
## Features
6+
7+
- Clean header with current section title and slide title
8+
- Footer with slide counter (`current / total`)
9+
- Title slide with centered layout
10+
- Section divider slides
11+
- Focus slides (full-color background for emphasis)
12+
- Matcha-green primary color (`#5E8B65`)
13+
14+
## Usage
15+
16+
Initialize a new presentation from this template:
17+
18+
```bash
19+
typst init @preview/touying-matcha:0.1.0 my-presentation
20+
cd my-presentation
21+
typst compile main.typ
22+
```
23+
24+
Or import the theme directly in an existing Typst project:
25+
26+
```typ
27+
#import "@preview/touying-matcha:0.1.0": *
28+
29+
#show: matcha-theme.with(
30+
aspect-ratio: "16-9",
31+
footer: none,
32+
)
33+
34+
#title-slide(
35+
title: "My Presentation",
36+
author: "Your Name",
37+
date: datetime.today(),
38+
)
39+
40+
= Section
41+
42+
== Slide Title
43+
44+
#slide[
45+
Content goes here...
46+
]
47+
48+
#focus-slide[
49+
Key takeaway
50+
]
51+
```
52+
53+
## Configuration
54+
55+
### `matcha-theme`
56+
57+
| Parameter | Default | Description |
58+
|---|---|---|
59+
| `aspect-ratio` | `"16-9"` | Slide aspect ratio (`"16-9"`, `"4-3"`, etc.) |
60+
| `footer` | `none` | Footer text displayed on each slide |
61+
62+
### Slide Functions
63+
64+
| Function | Description |
65+
|---|---|
66+
| `slide(title: auto, body)` | Standard content slide with optional title |
67+
| `title-slide(title, author, date)` | Centered title slide |
68+
| `new-section-slide(body)` | Section divider with current heading |
69+
| `focus-slide(body)` | Full-color emphasis slide |
70+
71+
## Dependencies
72+
73+
- `@preview/touying:0.7.4`
74+
75+
## License
76+
77+
MIT — Copyright (c) 2025 songwupei
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// Matcha theme for Touying
2+
// A fresh matcha-green presentation theme.
3+
#import "@preview/touying:0.7.4": *
4+
5+
#let slide(title: auto, ..args) = touying-slide-wrapper(self => {
6+
if title != auto {
7+
self.store.title = title
8+
}
9+
// set page
10+
let header(self) = {
11+
set align(top)
12+
show: components.cell.with(fill: self.colors.primary, inset: 1em)
13+
set align(horizon)
14+
set text(fill: self.colors.neutral-lightest, size: .7em)
15+
utils.display-current-heading(level: 1)
16+
linebreak()
17+
set text(size: 1.5em)
18+
if self.store.title != none {
19+
utils.call-or-display(self, self.store.title)
20+
} else {
21+
utils.display-current-heading(level: 2)
22+
}
23+
}
24+
let footer(self) = {
25+
set align(bottom)
26+
show: pad.with(.4em)
27+
set text(fill: self.colors.neutral-darkest, size: .8em)
28+
utils.call-or-display(self, self.store.footer)
29+
h(1fr)
30+
context utils.slide-counter.display() + " / " + utils.last-slide-number
31+
}
32+
self = utils.merge-dicts(
33+
self,
34+
config-page(
35+
header: header,
36+
footer: footer,
37+
),
38+
)
39+
touying-slide(self: self, ..args)
40+
})
41+
42+
#let title-slide(..args) = touying-slide-wrapper(self => {
43+
let info = self.info + args.named()
44+
let body = {
45+
set align(center + horizon)
46+
block(
47+
fill: self.colors.primary,
48+
width: 80%,
49+
inset: (y: 1em),
50+
radius: 1em,
51+
text(size: 2em, fill: self.colors.neutral-lightest, weight: "bold", info.title),
52+
)
53+
set text(fill: self.colors.neutral-darkest)
54+
if info.author != none {
55+
block(info.author)
56+
}
57+
if info.date != none {
58+
block(utils.display-info-date(self))
59+
}
60+
}
61+
touying-slide(self: self, body)
62+
})
63+
64+
#let new-section-slide(self: none, body) = touying-slide-wrapper(self => {
65+
let main-body = {
66+
set align(center + horizon)
67+
set text(size: 2em, fill: self.colors.primary, weight: "bold", style: "italic")
68+
utils.display-current-heading(level: 1)
69+
}
70+
touying-slide(self: self, main-body)
71+
})
72+
73+
#let focus-slide(body) = touying-slide-wrapper(self => {
74+
self = utils.merge-dicts(
75+
self,
76+
config-page(
77+
fill: self.colors.primary,
78+
margin: 2em,
79+
),
80+
)
81+
set text(fill: self.colors.neutral-lightest, size: 2em)
82+
touying-slide(self: self, align(horizon + center, body))
83+
})
84+
85+
#let matcha-theme(
86+
aspect-ratio: "16-9",
87+
footer: none,
88+
..args,
89+
body,
90+
) = {
91+
set text(size: 20pt)
92+
93+
show: touying-slides.with(
94+
config-page(
95+
paper: "presentation-" + aspect-ratio,
96+
margin: (top: 4em, bottom: 1.5em, x: 2em),
97+
),
98+
config-common(
99+
slide-fn: slide,
100+
new-section-slide-fn: new-section-slide,
101+
),
102+
config-methods(alert: utils.alert-with-primary-color),
103+
config-colors(
104+
primary: rgb("#5E8B65"),
105+
neutral-lightest: rgb("#ffffff"),
106+
neutral-darkest: rgb("#000000"),
107+
),
108+
config-store(
109+
title: none,
110+
footer: footer,
111+
),
112+
..args,
113+
)
114+
115+
body
116+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Starter presentation using the Matcha theme.
2+
// Build with: typst compile main.typ
3+
4+
#import "@preview/touying-matcha:0.1.0": *
5+
6+
#show: matcha-theme.with(
7+
aspect-ratio: "16-9",
8+
footer: none,
9+
)
10+
11+
#title-slide(
12+
title: "My Presentation",
13+
author: "Your Name",
14+
date: datetime.today(),
15+
)
16+
17+
= Section
18+
19+
== Slide Title
20+
21+
#slide[
22+
Content goes here...
23+
]
24+
25+
#focus-slide[
26+
Key takeaway
27+
]
54.2 KB
Loading
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "touying-matcha"
3+
version = "0.1.0"
4+
entrypoint = "template/lib.typ"
5+
authors = ["songwupei"]
6+
license = "MIT"
7+
description = "A fresh matcha-green theme for the Touying presentation framework, featuring clean headers, slide counters, and focus slides."
8+
repository = "https://codeberg.org/songwupei/touying-matcha"
9+
keywords = ["touying", "matcha", "presentation", "theme", "green", "slide"]
10+
categories = ["presentation"]
11+
compiler = "0.13.1"
12+
exclude = ["example.pdf", ".gitignore"]
13+
14+
[template]
15+
path = "template"
16+
entrypoint = "main.typ"
17+
thumbnail = "thumbnail.png"

0 commit comments

Comments
 (0)