diff --git a/themes/bipartite.typ b/themes/bipartite.typ deleted file mode 100644 index dc3bcbe..0000000 --- a/themes/bipartite.typ +++ /dev/null @@ -1,80 +0,0 @@ -// This theme is inspired by https://slidesgo.com/theme/modern-annual-report - -#import "../logic.typ" - - -#let bipartite-dark = rgb("#192e41") -#let bipartite-bright = rgb("#fafafa") -#let bipartite-accent = rgb("#fc9278") - -#let bipartite-theme( - aspect-ratio: "16-9", - body -) = { - set page( - paper: "presentation-" + aspect-ratio, - margin: 0pt, - ) - - body -} - -#let title-slide(title: [], subtitle: none, author: [], date: none) = { - let title-block(fg, bg, height, body) = block( - width: 100%, height: height, outset: 0em, inset: 0em, breakable: false, - stroke: none, spacing: 0em, fill: bg, - align(center + horizon, text(fill: fg, body)) - ) - let content = { - title-block(bipartite-dark, bipartite-bright, 60%, text(1.7em, title)) - title-block(bipartite-bright, bipartite-dark, 40%, { - if subtitle != none { - text(size: 1.2em, subtitle) - parbreak() - } - - text(size: .9em, { author; if date != none { h(1em); sym.dot.c; h(1em); date } }) - }) - place( - center + horizon, dy: 10%, - rect(width: 6em, height: .5em, radius: .25em, fill: bipartite-accent) - ) - } - logic.polylux-slide(content) -} - -#let _bipartite-content-box(fg, bg, width, alignment, body) = box( - width: width, height: 100%, outset: 0em, inset: (x: 1em), baseline: 0em, - stroke: none, fill: bg, - align(alignment + horizon, text(fill: fg, body)) -) - -#let west-slide(title: none, body) = { - let content = { - _bipartite-content-box( - bipartite-bright, bipartite-dark, 30%, left, - if title != none { heading(level: 2, title) } else { [] } - ) - _bipartite-content-box(bipartite-dark, bipartite-bright, 70%, left, body) - } - logic.polylux-slide(content) -} - -#let east-slide(title: none, body) = { - let content = { - _bipartite-content-box(bipartite-dark, bipartite-bright, 70%, right, body) - _bipartite-content-box( - bipartite-bright, bipartite-dark, 30%, right, - if title != none { heading(level: 2, title) } else { [] } - ) - } - logic.polylux-slide(content) -} - -#let split-slide(body-left, body-right) = { - let content = { - _bipartite-content-box(bipartite-dark, bipartite-bright, 50%, right, body-left) - _bipartite-content-box(bipartite-bright, bipartite-dark, 50%, left, body-right) - } - logic.polylux-slide(content) -} diff --git a/themes/clean.typ b/themes/clean.typ deleted file mode 100644 index 46155d6..0000000 --- a/themes/clean.typ +++ /dev/null @@ -1,188 +0,0 @@ -// This theme contains ideas from the former "bristol" theme, contributed by -// https://github.com/MarkBlyth - -#import "../logic.typ" -#import "../utils/utils.typ" - -#let clean-footer = state("clean-footer", []) -#let clean-short-title = state("clean-short-title", none) -#let clean-color = state("clean-color", teal) -#let clean-logo = state("clean-logo", none) - - -#let clean-theme( - aspect-ratio: "16-9", - footer: [], - short-title: none, - logo: none, - color: teal, - body -) = { - set page( - paper: "presentation-" + aspect-ratio, - margin: 0em, - header: none, - footer: none, - ) - set text(size: 25pt) - show footnote.entry: set text(size: .6em) - - clean-footer.update(footer) - clean-color.update(color) - clean-short-title.update(short-title) - clean-logo.update(logo) - - body -} - - -#let title-slide( - title: none, - subtitle: none, - authors: (), - date: none, - watermark: none, - secondlogo: none, -) = { - let content = context{ - let color = clean-color.at(here()) - let logo = clean-logo.at(here()) - let authors = if type(authors) in ("string", "content") { - ( authors, ) - } else { - authors - } - - if watermark != none { - set image(width: 100%) - place(watermark) - } - - v(5%) - grid(columns: (5%, 1fr, 1fr, 5%), - [], - if logo != none { - set align(bottom + left) - set image(height: 3em) - logo - } else { [] }, - if secondlogo != none { - set align(bottom + right) - set image(height: 3em) - secondlogo - } else { [] }, - [] - ) - - v(-10%) - align(center + horizon)[ - #block( - stroke: ( y: 1mm + color ), - inset: 1em, - breakable: false, - [ - #text(1.3em)[*#title*] \ - #{ - if subtitle != none { - parbreak() - text(.9em)[#subtitle] - } - } - ] - ) - #set text(size: .8em) - #grid( - columns: (1fr,) * calc.min(authors.len(), 3), - column-gutter: 1em, - row-gutter: 1em, - ..authors - ) - #v(1em) - #date - ] - } - logic.polylux-slide(content) -} - -#let slide(title: none, body) = { - let header = align(top, context{ - let color = clean-color.at(here()) - let logo = clean-logo.at(here()) - let short-title = clean-short-title.at(here()) - - show: block.with(stroke: (bottom: 1mm + color), width: 100%, inset: (y: .3em)) - set text(size: .5em) - - grid( - columns: (1fr, 1fr), - if logo != none { - set align(left) - set image(height: 4em) - logo - } else { [] }, - if short-title != none { - align(horizon + right, grid( - columns: 1, rows: 1em, gutter: .5em, - short-title, - utils.current-section - )) - } else { - align(horizon + right, utils.current-section) - } - ) - }) - - let footer = context{ - let color = clean-color.at(here()) - - block( - stroke: ( top: 1mm + color ), width: 100%, inset: ( y: .3em ), - text(.5em, { - clean-footer.display() - h(1fr) - logic.logical-slide.display() - }) - ) - } - - set page( - margin: ( top: 4em, bottom: 2em, x: 1em ), - header: header, - footer: footer, - footer-descent: 1em, - header-ascent: 1.5em, - ) - - let body = pad(x: .0em, y: .5em, body) - - - let content = { - if title != none { - heading(level: 2, title) - } - body - } - - logic.polylux-slide(content) -} - -#let focus-slide(background: teal, foreground: white, body) = { - set page(fill: background, margin: 2em) - set text(fill: foreground, size: 1.5em) - let content = { v(.1fr); body; v(.1fr) } - // logic.polylux-slide(align(horizon, body)) - logic.polylux-slide(content) -} - -#let new-section-slide(name) = { - set page(margin: 2em) - let content = context{ - let color = clean-color.at(here()) - set align(center + horizon) - show: block.with(stroke: ( bottom: 1mm + color ), inset: 1em,) - set text(size: 1.5em) - strong(name) - utils.register-section(name) - } - logic.polylux-slide(content) -} diff --git a/themes/simple.typ b/themes/simple.typ deleted file mode 100644 index 25072cd..0000000 --- a/themes/simple.typ +++ /dev/null @@ -1,60 +0,0 @@ -#import "../logic.typ" - -#let simple-footer = state("simple-footer", []) - -#let simple-theme( - aspect-ratio: "16-9", - footer: [], - background: white, - foreground: black, - body -) = { - set page( - paper: "presentation-" + aspect-ratio, - margin: 2em, - header: none, - footer: none, - fill: background, - ) - set text(fill: foreground, size: 25pt) - show footnote.entry: set text(size: .6em) - show heading.where(level: 2): set block(below: 2em) - set outline(target: heading.where(level: 1), title: none, fill: none) - show outline.entry: it => it.body - show outline: it => block(inset: (x: 1em), it) - - simple-footer.update(footer) - - body -} - -#let centered-slide(body) = { - logic.polylux-slide(align(center + horizon, body)) -} - -#let title-slide(body) = { - set heading(outlined: false) - centered-slide(body) -} - -#let focus-slide(background: aqua.darken(50%), foreground: white, body) = { - set page(fill: background) - set text(fill: foreground, size: 1.5em) - logic.polylux-slide(align(center + horizon, body)) -} - -#let slide(body) = { - let deco-format(it) = text(size: .6em, fill: gray, it) - set page( - header: context{ - let sections = query(heading.where(level: 1, outlined: true).before(here()), here()) - if sections == () [] else { deco-format(sections.last().body) } - }, - footer: deco-format({ - simple-footer.display(); h(1fr); logic.logical-slide.display() - }), - footer-descent: 1em, - header-ascent: 1em, - ) - logic.polylux-slide(body) -} diff --git a/themes/themes.typ b/themes/themes.typ deleted file mode 100644 index c3ef0ed..0000000 --- a/themes/themes.typ +++ /dev/null @@ -1,5 +0,0 @@ -#import "simple.typ" -#import "clean.typ" -#import "bipartite.typ" -#import "university.typ" -#import "metropolis.typ" diff --git a/themes/university.typ b/themes/university.typ deleted file mode 100644 index 474cc9c..0000000 --- a/themes/university.typ +++ /dev/null @@ -1,256 +0,0 @@ -#import "../logic.typ" -#import "../utils/utils.typ" - -// University theme -// -// Originally contributed by Pol Dellaiera - https://github.com/drupol -// -// Please feel free to improve this theme -// by submitting a PR in https://github.com/andreasKroepelin/typst-slides - -#let uni-colors = state("uni-colors", (:)) -#let uni-short-title = state("uni-short-title", none) -#let uni-short-author = state("uni-short-author", none) -#let uni-short-date = state("uni-short-date", none) -#let uni-progress-bar = state("uni-progress-bar", true) - -#let university-theme( - aspect-ratio: "16-9", - short-title: none, - short-author: none, - short-date: none, - color-a: rgb("#0C6291"), - color-b: rgb("#A63446"), - color-c: rgb("#FBFEF9"), - progress-bar: true, - size: 25pt, - body -) = { - set page( - paper: "presentation-" + aspect-ratio, - margin: 0em, - header: none, - footer: none, - ) - set text(size: size) - show footnote.entry: set text(size: .6em) - - uni-progress-bar.update(progress-bar) - uni-colors.update((a: color-a, b: color-b, c: color-c)) - uni-short-title.update(short-title) - uni-short-author.update(short-author) - uni-short-date.update(short-date) - - body -} - -#let title-slide( - title: [], - subtitle: none, - authors: (), - institution-name: "University", - date: none, - logo: none, -) = { - let authors = if type(authors) == "array" { authors } else { (authors,) } - - let content = context{ - let colors = uni-colors.at(here()) - - if logo != none { - align(right, logo) - } - - align(center + horizon, { - block( - inset: 0em, - breakable: false, - { - text(size: 2em, fill: colors.a, strong(title)) - if subtitle != none { - parbreak() - text(size: 1.2em, fill: colors.a, subtitle) - } - } - ) - set text(size: .8em) - grid( - columns: (1fr,) * calc.min(authors.len(), 3), - column-gutter: 1em, - row-gutter: 1em, - ..authors.map(author => text(fill: black, author)) - ) - v(1em) - if institution-name != none { - parbreak() - text(size: .9em, institution-name) - } - if date != none { - parbreak() - text(size: .8em, date) - } - }) - } - - logic.polylux-slide(content) -} - - -#let slide( - title: none, - header: none, - footer: none, - new-section: none, - body -) = { - - let body = pad(x: 2em, y: .5em, body) - - let progress-barline = context{ - if uni-progress-bar.at(here()) { - let cell = block.with( width: 100%, height: 100%, above: 0pt, below: 0pt, breakable: false ) - let colors = uni-colors.at(here()) - - utils.polylux-progress( ratio => { - grid( - rows: 2pt, columns: (ratio * 100%, 1fr), - cell(fill: colors.a), - cell(fill: colors.b) - ) - }) - } else { [] } - } - - let header-text = { - if header != none { - header - } else if title != none { - if new-section != none { - utils.register-section(new-section) - } - context{ - let colors = uni-colors.at(here()) - block( - fill: colors.c, - inset: (x: .5em), - grid( - columns: (1fr, auto), - align(top + left, heading(level: 2, text(fill: colors.a, title))), - align( - top + right, - text(fill: colors.a.lighten(65%), utils.current-section), - ), - ), - ) - } - } else { [] } - } - - let header = { - set align(top) - grid(rows: (auto, auto), row-gutter: 3mm, progress-barline, header-text) - } - - let footer = { - set text(size: 10pt) - set align(center + bottom) - let cell(fill: none, it) = rect( - width: 100%, height: 100%, inset: 1mm, outset: 0mm, fill: fill, stroke: none, - align(horizon, text(fill: white, it)) - ) - if footer != none { - footer - } else { - context{ - let colors = uni-colors.at(here()) - - show: block.with(width: 100%, height: auto, fill: colors.b) - grid( - columns: (25%, 1fr, 15%, 10%), - rows: (1.5em, auto), - cell(fill: colors.a, uni-short-author.get()), - cell(uni-short-title.get()), - cell(uni-short-date.get()), - cell(logic.logical-slide.display() + [~/~] + utils.last-slide-number) - ) - } - } - } - - - set page( - margin: ( top: 2em, bottom: 1em, x: 0em ), - header: header, - footer: footer, - footer-descent: 0em, - header-ascent: .6em, - ) - - logic.polylux-slide(body) -} - -#let focus-slide(background-color: none, background-img: none, body) = { - let background-color = if background-img == none and background-color == none { - rgb("#0C6291") - } else { - background-color - } - - set page(fill: background-color, margin: 1em) if background-color != none - set page( - background: { - set image(fit: "stretch", width: 100%, height: 100%) - background-img - }, - margin: 1em, - ) if background-img != none - - set text(fill: white, size: 2em) - - logic.polylux-slide(align(horizon, body)) -} - -#let matrix-slide(columns: none, rows: none, ..bodies) = { - let bodies = bodies.pos() - - let columns = if type(columns) == "integer" { - (1fr,) * columns - } else if columns == none { - (1fr,) * bodies.len() - } else { - columns - } - let num-cols = columns.len() - - let rows = if type(rows) == "integer" { - (1fr,) * rows - } else if rows == none { - let quotient = calc.quo(bodies.len(), num-cols) - let correction = if calc.rem(bodies.len(), num-cols) == 0 { 0 } else { 1 } - (1fr,) * (quotient + correction) - } else { - rows - } - let num-rows = rows.len() - - if num-rows * num-cols < bodies.len() { - panic("number of rows (" + str(num-rows) + ") * number of columns (" + str(num-cols) + ") must at least be number of content arguments (" + str(bodies.len()) + ")") - } - - let cart-idx(i) = (calc.quo(i, num-cols), calc.rem(i, num-cols)) - let color-body(idx-body) = { - let (idx, body) = idx-body - let (row, col) = cart-idx(idx) - let color = if calc.even(row + col) { white } else { silver } - set align(center + horizon) - rect(inset: .5em, width: 100%, height: 100%, fill: color, body) - } - - let content = grid( - columns: columns, rows: rows, - gutter: 0pt, - ..bodies.enumerate().map(color-body) - ) - - logic.polylux-slide(content) -}