aboutsummaryrefslogtreecommitdiff
path: root/typst/callout/1.0.0/lib.typ
blob: 07c136ec3351db89f20434fd3536c171b1809ce2 (plain)
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
#let emptyblock((fontcolor, bgcolor), content) = {
  set par(
    leading: 0.75em,
    first-line-indent: 0em,
    spacing: 1.3em,
  )
  set text(fill: fontcolor)
  block(
    width: 100%, 
    inset: 1.5em, 
    radius: 0.5em, 
    breakable: false,
    fill: bgcolor, 
    content
  )
}

#let title(content) = text(size: 1.15em, strong(content))

#let callout(icon, title_content, colors, content) = {
  emptyblock(colors)[
    #text(size: 1.15em)[#icon~ #strong(title_content)]

    #content
  ]
}

#let warning(body) = {
  callout(
    emoji.warning, 
    "Attention", 
    (oklch(25%, 35%, 52.55deg), oklch(68.9%, 44%, 52.55deg, 15%)),
    body,
  )
}

#let solution(body) = {
  callout(
    emoji.checkmark.box, 
    "Solution",
    (rgb("#2AA63D"), rgb("#DBFCE7"), rgb("#7AF0A8")), 
    body,
  )
}

#let defn(body) = {
  callout(
    $Delta$,
    "Définition", 
    (oklch(20%, 20%, 247deg), oklch(75%, 25%, 247deg, 40%)),
    body,
  )
}

#let props(body) = {
  callout(
    $Pi$,
    "Proposition", 
    (oklch(20%, 20%, 247deg), oklch(85%, 10%, 247deg, 50%)),
    body,
  )
}

#let thm(body) = {
  callout(
    $Tau$,
    "Théorème", 
    (oklch(20%, 20%, 220deg), oklch(80%, 25%, 220deg, 40%)),
    body,
  )
}

#let proof(body) = {
  set par(
    leading: 0.5em,
    first-line-indent: 0em,
    spacing: 1.2em,
  )
  set text(size: 0.9em, fill: luma(70))
  block(
    stroke: (left: 1pt + black),
    inset: 1em,
  )[
    #title("Preuve")

    #body
  ]
}