Skip to content

✨ Pyro theme #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internals.typ
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
///
/// - theme (theme):
/// -> content
#let print-entries(theme: (:)) = {
#let print-entries(theme: (:), cover-ctx: (:)) = {
let print-helper(section, state) = {
locate(loc => {
for entry in state.final(loc) [
#let entry-func = fallback-to-default(section + "-entry", theme)
#let body = [] + entry.body
#entry-func(body, ctx: entry.ctx)
#entry-func(body, ctx: entry.ctx + cover-ctx)
]
})
}
Expand Down
3 changes: 2 additions & 1 deletion lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
let rules = theme.rules
show: doc => rules(doc)

let cover-ctx = (team-name: team-name, season: season, year: year)
let cover-content = if cover == none {
let ctx = (team-name: team-name, season: season, year: year)
print-cover(ctx: ctx, theme: theme)
Expand All @@ -43,6 +44,6 @@

page[] // Filler page

print-entries(theme: theme)
print-entries(theme: theme, cover-ctx: cover-ctx)
body // FIXME: this should be ignored, but the document doesn't properly render without it.
}
13 changes: 13 additions & 0 deletions themes/pyro/colors.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#let gray = rgb("#BBBBBB")
#let blue = rgb("#0077bb")
#let light-blue = rgb("#33bbee")
#let green = rgb("#009988")
#let orange = rgb("#ee7733")
#let red = rgb("#cc3311")
#let pink = rgb("#ee3377")

#let surface-0 = rgb("#f1f3f5")
#let surface-1 = rgb("#e9ecef")
#let surface-2 = rgb("#dee2e6")
#let surface-3 = rgb("#ced4da")
#let surface-4 = rgb("#adb5bd")
4 changes: 4 additions & 0 deletions themes/pyro/components/components.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import "./toc.typ": *
#import "./pro-con.typ": *
#import "./decision-matrix.typ": *
#import "./glossary.typ": *
33 changes: 33 additions & 0 deletions themes/pyro/components/decision-matrix.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#import "/utils.typ"
#import "../colors.typ": *

#let decision-matrix(properties: none, ..choices) = {
let data = utils.calc-decision-matrix(properties: properties, ..choices)
let body-cell = box.with(width: 100%, inset: 5pt)
let top-left-corner-cell = body-cell.with(radius: 5pt)
let top-right-corner-cell = body-cell.with(radius: 50pt, fill: red)
grid(
inset: -0.1pt,
columns: for _ in range(properties.len() + 2) {
(1fr,)
}, //
fill: (col, row) => {
if col == 0 and row == 0 { white }
else if calc.odd(row) { surface-3 }
else if calc.even(row) { surface-1 }
},
body-cell[],
//body-cell[*Weight*],
..for property in properties {
(body-cell[ *#property.name* ],)
},
top-right-corner-cell[*Total*],
..for choice in data {
//Override the fill if the choice has the highest score
//let cell = if choice.values.total.highest { cellx.with(fill: green) } else { cellx }
(body-cell[*#choice.name*], ..for value in choice.values {
(body-cell[#value.at(1).value],)
})
},
)
}
Empty file.
Empty file.
32 changes: 32 additions & 0 deletions themes/pyro/components/toc.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#import "/utils.typ"
#import "/packages.typ": tablex
#import tablex: *
#import "../colors.typ": *
#import "../metadata.typ": *
#import "../format.typ": *

#let toc() = utils.print-toc(
(frontmatter, body, appendix) => {
heading[Contents]

stack(
spacing: 1em,
..for entry in body {
(
[
#let entry-data = entry-types.at(entry.type)
#box(baseline: 25%)[#title(entry-data.color, entry.title)]
#h(1em)
#box(
width: 1fr,
line(length: 100%, start: (0pt, -.35em), stroke: (dash: "loosely-dotted")),
)
#h(1em)
#entry.page-number

],
)
},
)
},
)
79 changes: 79 additions & 0 deletions themes/pyro/entries.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#import "./metadata.typ": entry-types
#import "./colors.typ":*
#import "./format.typ": *

#let frontmatter-entry(ctx: (:), body) = {
show: page.with(
footer: align(center, context counter(page).display()),
background: place(rect(fill: gray, height: 100%, width: 15pt)),
)

body
}

#let body-entry(ctx: (:), body) = {
let entry-data = entry-types.at(ctx.type)

show: page.with(
header: [
#grid(
columns: (1fr, 2fr, 1fr),
[
#set text(font: "Tele-Marines", weight: "bold")
#ctx.team-name
], // TODO: get team name from from ctx
[
#set align(center)
#ctx.season
Engineering Notebook
],
[
#set align(right)
#ctx.date.display("[month repr:long] [day padding:none], [year]")
],
)
#line(length: 100%, stroke: 0.5pt)
],
footer: [
#line(length: 100%, stroke: 0.5pt)
#grid(
columns: (1fr, 0.3fr, 1fr),
[
#set text(11pt)
_All information in this document is property of team #ctx.team-name, unless
otherwise stated_
],
[
#set align(center)
#context counter(page).display()
],
[
#set align(right)
*Signature:* #ctx.author
#linebreak()
*Witness:* #ctx.witness
],
)
],
background: place[#rect(fill: entry-data.color, height: 100%, width: 15pt)],
)

block[
#title(entry-data.color)[#ctx.title]
#h(1fr)
#title(entry-data.color)[#entry-data.title]
]

show image: it => {
box(stroke: 5pt + entry-data.color, radius: 1em, clip: true, it)
}

body
}

// TODO: make an actual appendix entry
#let appendix-entry(ctx: (:), body) = {
show: page.with(header: [ = Appendix header ], footer: [Appendix footer])

body
}
33 changes: 33 additions & 0 deletions themes/pyro/format.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#import "./colors.typ": *

#let title(color, body) = box(fill: color, inset: 9pt, radius: 5em)[
#set text(fill: white, font: "Calibri", 12pt, weight: "bold")
#body
]

#let rules(doc) = {
doc
}

#let cover(ctx: (:)) = {
grid(
columns: (10em, 1fr),
gutter: 20pt,
rect(width: 100%, height: 100%, fill: red),
grid(
rows: (1fr, 1fr),
[
#set align(horizon)
#set text(50pt, font: "Tele-Marines", fill: gradient.linear(red, yellow))
#ctx.team-name
],
[
#set text(30pt, fill: red)
Digital Engineering Notebook

#set text(20pt, fill: black)
#ctx.season
],
),
)
}
16 changes: 16 additions & 0 deletions themes/pyro/metadata.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#import "./colors.typ": *

#let entry-types = (
"understand": (color: blue, title: "Understand"),
"explore": (color: blue, title: "Explore"),
"define": (color: light-blue, title: "Define"),
"ideate": (color: light-blue, title: "Ideate"),
"prototype": (color: light-blue, title: "Prototype"),
"choose": (color: green, title: "Choose"),
"refine": (color: orange, title: "Refine"),
"present": (color: orange, title: "Present"),
"implement": (color: orange, title: "Implement"),
"test": (color: red, title: "Test"),
"iterate": (color: pink, title: "Iterate"),
"information": (color: gray, title: "Information"),
)
13 changes: 13 additions & 0 deletions themes/pyro/pyro.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#import "./format.typ": *
#import "./entries.typ": *
#import "./components/components.typ"

#let pyro-theme = (
// Global show rules
rules: rules,
cover: cover,
// Entry pages
frontmatter-entry: frontmatter-entry,
body-entry: body-entry,
appendix-entry: appendix-entry,
)
3 changes: 2 additions & 1 deletion themes/themes.typ
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "./default/default.typ"
#import "./radial/radial.typ"
#import "./linear/linear.typ"
#import "./linear/linear.typ"
#import "./pyro/pyro.typ"
Loading