|
| 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 | +} |
0 commit comments