typst-ysec/slides/0.1.0/lib.typ
2024-09-18 14:35:23 +02:00

82 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#import "@preview/touying:0.5.2": *
#import themes.university: university-theme
#let heig-red = rgb("#e1251b")
#let heig-logo = block(
inset: 10pt,
image("assets/logo.svg", alt: "HEIG-VD", fit: "contain", width: 40%)
)
#let codeframe(title: none, body) = {
let stroke = black + 1pt
let radius = 0.5em
let fill = gray.lighten(90%)
box(stroke: stroke, radius: radius, fill: fill)[
#if title != none {
block(
stroke: stroke,
inset: 0.5em,
below: 0em,
radius: (top-left: radius, bottom-right: radius),
title,
)
}
#block(
width: 100%,
inset: (rest: 0.7em),
body,
)
]
}
#let heig-theme(..args, body) = {
set text(font: "Carlito")
set list(marker: ( text(fill: heig-red, [▪]), [‣], []))
set table(inset: 10pt)
show raw.where(block: true): codeframe
show raw.where(block: false): b => {
set text(fill: heig-red)
h(0.2em) + box(b, outset: (x: 0.2em, y: 0.3em), radius: 0.3em, fill: gray.lighten(70%)) + h(0.2em)
}
show link: lnk => { set text(fill: blue); underline(lnk) }
university-theme(
footer-c: self => {
set text(fill: black)
h(1fr)
utils.display-info-date(self)
h(1fr)
context utils.slide-counter.display() + " / " + utils.last-slide-number
h(1fr)
},
config-colors(
primary: heig-red,
secondary: rgb("#444444"),
tertiary: rgb("#eeeeee")
),
..args,
body
)}
#let note(color: gray, contents) = align(center + horizon, block(radius: 0.7em, fill: color.lighten(30%), inset: 0.5em, contents))
#let danger-sign = polygon.regular(
fill: red.darken(40%),
size: 2.5em,
vertices: 3,
) + place(center, dy: -1em, text(fill: red.lighten(30%), "!") )
#let danger(contents) = note(color: red, grid(columns: (auto, auto), gutter: 0.5em, danger-sign, contents))
#let qmark = circle(text(size: 1.5em, fill: blue.lighten(30%), "?"), fill: blue.darken(50%))
#let question(contents) = note(color: blue, grid(columns: (auto, auto), gutter: 0.5em, qmark, contents))