146 lines
3.3 KiB
Typst
146 lines
3.3 KiB
Typst
#import "sns_polylux_template.typ": *
|
|
#import "figures.typ": figures, get_figure
|
|
|
|
#import "../lib.typ": pb1-text, pb2-text, pb3-text
|
|
#import "icons.typ": th-outline
|
|
|
|
#let pirat-color = (
|
|
black: rgb("#000000"),
|
|
white: rgb("#FFFFFF"),
|
|
red: rgb("#E33d1C"),
|
|
blue: rgb("#4AC3CB"),
|
|
)
|
|
|
|
#let sns-polylux-template_sns-pirat = (
|
|
pirat-color.blue.darken(30%), //rgb("#00728D"),
|
|
pirat-color.blue.darken(50%),
|
|
pirat-color.blue.darken(80%),
|
|
rgb("#AB3502"),
|
|
rgb("#E69426"),
|
|
pirat-color.red,
|
|
)
|
|
|
|
#let etal = [_et al._]
|
|
|
|
#let highlight-block(body) = {
|
|
set text(fill: white)
|
|
block(
|
|
fill: pirat-color.blue.darken(30%),
|
|
width: 100%,
|
|
inset: 8pt,
|
|
radius: 4pt,
|
|
body,
|
|
)
|
|
}
|
|
|
|
#let colortest = [
|
|
#for th in (
|
|
sns-polylux-template_sns-pirat,
|
|
sns-polylux-template_sns-colormap,
|
|
sns-polylux-template_unipi-colormap,
|
|
) {
|
|
stack(dir: ltr, ..for c in th {
|
|
(rect(width: 30pt, height: 30pt, fill: c),)
|
|
})
|
|
}
|
|
]
|
|
|
|
#let highlight-color = pirat-color.blue.lighten(40%)
|
|
|
|
/* don't work ? at least for raw block?
|
|
#let scale-down-to-page(body) = {
|
|
layout(size => {
|
|
let size_body = measure(body)
|
|
let ratio = if size_body.width == 0pt and size_body.height == 0pt {
|
|
none
|
|
} else if size_body.width == 0pt {
|
|
size.height / size_body.height
|
|
} else if size_body.height == 0pt {
|
|
size.width / size_body.width
|
|
} else {
|
|
let r_x = size.width / size_body.width
|
|
let r_y = size.height / size_body.height
|
|
calc.max(r_x, r_y)
|
|
}
|
|
if ratio == none or ratio >= 1 {
|
|
body
|
|
} else {
|
|
scale(ratio * 100%, body)
|
|
}
|
|
repr(size)
|
|
linebreak()
|
|
repr(size_body)
|
|
linebreak()
|
|
repr(ratio*100%)
|
|
})
|
|
}
|
|
*/
|
|
|
|
#let place-fg(x: 0pt, y: 0pt, body) = context {
|
|
let s = measure(body)
|
|
let hx = s.width / 2
|
|
let hy = s.height / 2
|
|
|
|
place(
|
|
bottom + left,
|
|
dx: x - hx,
|
|
dy: -y + hy,
|
|
body
|
|
)
|
|
}
|
|
|
|
#let ghost(
|
|
img, x: 0pt,
|
|
y: 0pt,
|
|
mirror: false,
|
|
rot: 0deg,
|
|
height: 100pt
|
|
) = {
|
|
let img = image(img, height: height)
|
|
if mirror {
|
|
img = scale(x: -100%, img)
|
|
}
|
|
if rot != 0deg {
|
|
img = rotate(rot, img)
|
|
}
|
|
place-fg(x: x, y: y, img)
|
|
}
|
|
|
|
#let ghost-1 = ghost.with("imgs/ghosts/ghost-1.png")
|
|
#let ghost-2 = ghost.with("imgs/ghosts/ghost-2.png")
|
|
#let ghost-3 = ghost.with("imgs/ghosts/ghost-3.png")
|
|
#let ghost-4 = ghost.with("imgs/ghosts/ghost-4.png")
|
|
#let ghost-5 = ghost.with("imgs/ghosts/ghost-5.png")
|
|
#let ghost-6 = ghost.with("imgs/ghosts/ghost-6.png")
|
|
#let ghost-7 = ghost.with("imgs/ghosts/ghost-7.png")
|
|
#let eye-1 = ghost.with("imgs/ghosts/eye-1.png")
|
|
#let eye-2 = ghost.with("imgs/ghosts/eye-2.png")
|
|
#let eye-3 = ghost.with("imgs/ghosts/eye-3.png")
|
|
#let eye-4 = ghost.with("imgs/ghosts/eye-4.png")
|
|
|
|
#let arrow(start, end, strk: 3pt + black) = {
|
|
let strk = stroke(strk)
|
|
start.at(1) = -start.at(1)
|
|
end.at(1) = -end.at(1)
|
|
let (xe, ye) = end
|
|
let (xs, ys) = start
|
|
let w = xe.pt() - xs.pt()
|
|
let h = ye.pt() - ys.pt()
|
|
let len = if w == 0pt and h == 0pt {
|
|
1pt
|
|
} else {
|
|
calc.sqrt(w*w + h*h)
|
|
}
|
|
let cos = w / len
|
|
let sin = h / len
|
|
|
|
place(bottom + left, line(start: start, end: end, stroke: strk))
|
|
place(bottom + left, polygon(
|
|
fill: strk.paint,
|
|
stroke: strk,
|
|
end,
|
|
(xe + strk.thickness * (sin - cos), ye - strk.thickness * (sin + cos )),
|
|
(xe - strk.thickness * (sin + cos), ye - strk.thickness * (sin - cos )),
|
|
))
|
|
}
|
|
|