aboutsummaryrefslogtreecommitdiff
path: root/typst/callout/1.0.0/lib.typ
blob: 5add04a8ace8513a69481319b0f32dbbf6fe6dd2 (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
#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 callout(icon, title, title_content, colors, content) = {
  emptyblock(colors)[
    #text(size: 1.25em)[#icon~ #strong(title)]

    #content
  ]
}

#let warning(body) = {
  callout(
    emoji.warning, 
    "Attention", 
    title,
    (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", 
    title,
    (oklch(20%, 20%, 247deg), oklch(75%, 25%, 247deg, 40%)),
    body,
  )
}

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

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