Repository navigation
Expand file tree
/
Copy pathlib.typ
More file actions
82 lines (73 loc) · 3.01 KB
/
Copy pathlib.typ
File metadata and controls
82 lines (73 loc) · 3.01 KB
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
// Shared drawing helpers + theme for the Screen Mask illustrations.
// Pure native Typst (no external packages) so it renders fully offline.
#let bg = rgb("#0f1218")
#let panel = rgb("#1a1f2b")
#let panel2 = rgb("#222838")
#let strk = rgb("#333c50")
#let ink = rgb("#eef2f8")
#let muted = rgb("#9aa4b8")
#let blue = rgb("#4f9cf9")
#let green = rgb("#46c39a")
#let amber = rgb("#e0a458")
#let pink = rgb("#e06a8b")
#let violet = rgb("#a986e8")
// Page setup used by every diagram.
#let sheet(w, h, body) = {
set page(width: w * 1pt, height: h * 1pt, margin: 0pt, fill: bg)
set text(font: ("DejaVu Sans", "Liberation Sans"), fill: ink)
body
}
// A rounded module box at absolute (x,y) with size (w,h).
#let node(x, y, w, h, title, sub: none, fill: panel, stroke: strk, accent: none, tsize: 12pt) = {
place(top + left, dx: x * 1pt, dy: y * 1pt, {
box(width: w * 1pt, height: h * 1pt, radius: 8pt, fill: fill, stroke: 0.9pt + stroke, inset: 10pt,
align(center + horizon, {
set text(fill: ink)
strong(text(size: tsize, title))
if sub != none {
linebreak()
text(fill: muted, size: 8.5pt, sub)
}
})
)
// optional left accent bar
if accent != none {
place(top + left, box(width: 5pt, height: h * 1pt, radius: (left: 8pt), fill: accent))
}
})
}
// Translucent grouping container with a label tab.
#let group(x, y, w, h, label, col) = {
place(top + left, dx: x * 1pt, dy: y * 1pt,
box(width: w * 1pt, height: h * 1pt, radius: 12pt,
fill: col.transparentize(90%), stroke: (paint: col.transparentize(45%), thickness: 1pt, dash: "dashed")))
place(top + left, dx: (x + 12) * 1pt, dy: (y - 9) * 1pt,
box(fill: bg, inset: (x: 6pt, y: 1pt), text(size: 9pt, fill: col, weight: "bold", upper(label))))
}
// Solid line + triangular arrowhead from (x1,y1) to (x2,y2).
#let arrow(x1, y1, x2, y2, col: muted, w: 1.5pt, dash: none) = {
place(top + left, line(start: (x1 * 1pt, y1 * 1pt), end: (x2 * 1pt, y2 * 1pt), stroke: (paint: col, thickness: w, dash: dash)))
let a = calc.atan2(x2 - x1, y2 - y1)
let s = 10
let bx = x2 - s * calc.cos(a)
let by = y2 - s * calc.sin(a)
let p = a + 90deg
let hw = 5
place(top + left, polygon(fill: col,
(x2 * 1pt, y2 * 1pt),
((bx + hw * calc.cos(p)) * 1pt, (by + hw * calc.sin(p)) * 1pt),
((bx - hw * calc.cos(p)) * 1pt, (by - hw * calc.sin(p)) * 1pt)))
}
// A small free-floating text label (top-left anchored).
#let lbl(x, y, body, col: muted, size: 9pt, weight: "regular") = place(top + left, dx: x * 1pt, dy: y * 1pt,
text(size: size, fill: col, weight: weight, body))
// Filled swatch square.
#let swatch(x, y, s, col, sel: false) = place(top + left, dx: x * 1pt, dy: y * 1pt,
box(width: s * 1pt, height: s * 1pt, radius: 3pt, fill: col,
stroke: if sel { 2pt + blue } else { 0.8pt + strk }))
// Page title block.
#let heading-block(title, subtitle) = place(top + left, dx: 34pt, dy: 26pt, {
text(size: 22pt, fill: ink, weight: "bold", title)
linebreak()
text(size: 11pt, fill: muted, subtitle)
})