-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.typ
96 lines (76 loc) · 1.76 KB
/
utils.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#let _theme-colors = (
bluey: rgb("3059AB"),
reddy: rgb("BF3D3D"),
greeny: rgb("28842F"),
yelly: rgb("C4853D"),
purply: rgb("862A70"),
dusky: rgb("1F4289"),
darky: black,
)
//************************************************************************\\
#let _resize-text(body) = layout(size => {
let font-size = text.size
let (height,) = measure(
block(width: size.width, text(size: font-size)[#body]),
)
let max_height = size.height
while height > max_height {
font-size -= 0.2pt
height = measure(
block(width: size.width, text(size: font-size)[#body]),
).height
}
block(
height: height,
width: 100%,
text(size: font-size)[#body],
)
})
//************************************************************************\\
#let _divider(color: none) = {
line(
length: 100%,
stroke: 2.5pt + color,
)
}
//************************************************************************\\
#let _slide-header(title, color) = {
rect(
fill: color,
width: 100%,
height: if title != none {
1.6cm
} else {
.95cm
},
inset: .6cm,
text(white, weight: "semibold", size: 24pt)[#h(.1cm) #title],
)
}
//************************************************************************\\
#let _make-frontpage(
title,
subtitle,
authors,
info,
theme-color,
) = {
set align(left + horizon)
set page(footer: none)
text(40pt, weight: "bold")[#smallcaps(title)]
v(-.95cm)
if subtitle != none {
set text(24pt)
v(.1cm)
subtitle
}
let subtext = []
if authors != none {
subtext += text(22pt, weight: "regular")[#authors]
}
if info != none {
subtext += text(20pt, fill: theme-color, weight: "regular")[#v(-.15cm) #info]
}
_divider(color: theme-color)
[#subtext]
}