From 2a4bff7c192f0fa26f37cd14197583d6334655e4 Mon Sep 17 00:00:00 2001 From: BattleCh1cken Date: Sun, 11 Feb 2024 16:59:19 -0500 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=9A=A7=20Created=20a=20pretty=20good?= =?UTF-8?q?=20starting=20point=20for=20the=20theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internals.typ | 4 +- lib.typ | 6 +-- themes/pyro/colors.typ | 7 ++++ themes/pyro/components.typ | 27 +++++++++++++ themes/pyro/entries.typ | 78 ++++++++++++++++++++++++++++++++++++++ themes/pyro/format.typ | 29 ++++++++++++++ themes/pyro/metadata.typ | 16 ++++++++ themes/pyro/pyro.typ | 13 +++++++ themes/themes.typ | 3 +- 9 files changed, 177 insertions(+), 6 deletions(-) create mode 100644 themes/pyro/colors.typ create mode 100644 themes/pyro/components.typ create mode 100644 themes/pyro/entries.typ create mode 100644 themes/pyro/format.typ create mode 100644 themes/pyro/metadata.typ create mode 100644 themes/pyro/pyro.typ diff --git a/internals.typ b/internals.typ index 9487335..f094bd2 100644 --- a/internals.typ +++ b/internals.typ @@ -24,13 +24,13 @@ /// /// - theme (theme): /// -> content -#let print-entries(theme: (:)) = { +#let print-entries(theme: (:), cover-context: (:)) = { 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, context: entry.context) + #entry-func(body, context: entry.context + cover-context) ] }) } diff --git a/lib.typ b/lib.typ index 992fc85..65ea77b 100644 --- a/lib.typ +++ b/lib.typ @@ -33,9 +33,9 @@ let rules = theme.rules show: doc => rules(doc) + let cover-context = (team-name: team-name, season: season, year: year) let cover-content = if cover == none { - let context = (team-name: team-name, season: season, year: year) - print-cover(context: context, theme: theme) + print-cover(context: cover-context, theme: theme) } else { cover } @@ -43,6 +43,6 @@ page[] // Filler page - print-entries(theme: theme) + print-entries(theme: theme, cover-context: cover-context) body // FIXME: this should be ignored, but the document doesn't properly render without it. } diff --git a/themes/pyro/colors.typ b/themes/pyro/colors.typ new file mode 100644 index 0000000..a68bfb0 --- /dev/null +++ b/themes/pyro/colors.typ @@ -0,0 +1,7 @@ +#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") diff --git a/themes/pyro/components.typ b/themes/pyro/components.typ new file mode 100644 index 0000000..f080be3 --- /dev/null +++ b/themes/pyro/components.typ @@ -0,0 +1,27 @@ +#import "/utils.typ" +#import "./format.typ": * +#import "./metadata.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 + + ],) + }, + ) + }, +) diff --git a/themes/pyro/entries.typ b/themes/pyro/entries.typ new file mode 100644 index 0000000..d54da62 --- /dev/null +++ b/themes/pyro/entries.typ @@ -0,0 +1,78 @@ +#import "./metadata.typ": entry-types +#import "./colors.typ":* +#import "./format.typ": * + +#let frontmatter-entry(context: (:), body) = { + show: page.with( + footer: align(center, counter(page).display()), + background: place(rect(fill: gray, height: 100%, width: 15pt)), + ) + + body +} + +#let body-entry(context: (:), body) = { + let entry-data = entry-types.at(context.type) + + show: page.with( + header: [ + #grid( + columns: (1fr, 2fr, 1fr), + [ + #set text(font: "Tele-Marines", weight: "bold") + #context.team-name + ], // TODO: get team name from from context + [ + #set align(center) + #context.season + Engineering Notebook + ], + [ + #set align(right) + #context.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 #context.team-name, unless + otherwise stated_ + ], + [ + #set align(center) + #counter(page).display() + ], + [ + #set align(right) + *Signature:* #context.author + #linebreak() + *Witness:* #context.witness + ], + ) + ], + background: place[#rect(fill: entry-data.color, height: 100%, width: 15pt)], + ) + + block[ + #title(entry-data.color)[#context.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 +} + +#let appendix-entry(context: (:), body) = { + show: page.with(header: [ = Appendix header ], footer: [Appendix footer]) + + body +} diff --git a/themes/pyro/format.typ b/themes/pyro/format.typ new file mode 100644 index 0000000..4023403 --- /dev/null +++ b/themes/pyro/format.typ @@ -0,0 +1,29 @@ +#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(context: (:)) = { + 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") + #context.team-name + ], [ + #set text(30pt, fill: red) + Digital Engineering Notebook + + #set text(20pt, fill: black) + #context.season + ]), + ) +} diff --git a/themes/pyro/metadata.typ b/themes/pyro/metadata.typ new file mode 100644 index 0000000..2c4fc36 --- /dev/null +++ b/themes/pyro/metadata.typ @@ -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"), +) diff --git a/themes/pyro/pyro.typ b/themes/pyro/pyro.typ new file mode 100644 index 0000000..9c81e3e --- /dev/null +++ b/themes/pyro/pyro.typ @@ -0,0 +1,13 @@ +#import "./format.typ": * +#import "./entries.typ": * +#import "./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, +) diff --git a/themes/themes.typ b/themes/themes.typ index 6fce657..57e8346 100644 --- a/themes/themes.typ +++ b/themes/themes.typ @@ -1,3 +1,4 @@ #import "./default/default.typ" #import "./radial/radial.typ" -#import "./linear/linear.typ" \ No newline at end of file +#import "./linear/linear.typ" +#import "./pyro/pyro.typ" From 74c974474687eea2133f2f79a2ccbb8a6cd47d43 Mon Sep 17 00:00:00 2001 From: BattleCh1cken Date: Sun, 25 Feb 2024 10:15:34 -0500 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=9A=A7=20Started=20work=20on=20the=20?= =?UTF-8?q?decision=20matrix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/pyro/colors.typ | 6 ++++ themes/pyro/components.typ | 57 ++++++++++++++++++++++++++++++-------- themes/pyro/format.typ | 24 +++++++++------- 3 files changed, 66 insertions(+), 21 deletions(-) diff --git a/themes/pyro/colors.typ b/themes/pyro/colors.typ index a68bfb0..37fc846 100644 --- a/themes/pyro/colors.typ +++ b/themes/pyro/colors.typ @@ -5,3 +5,9 @@ #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") diff --git a/themes/pyro/components.typ b/themes/pyro/components.typ index f080be3..2d2a575 100644 --- a/themes/pyro/components.typ +++ b/themes/pyro/components.typ @@ -1,6 +1,8 @@ #import "/utils.typ" #import "./format.typ": * #import "./metadata.typ": * +#import "/packages.typ": tablex +#import tablex: * #let toc() = utils.print-toc( (frontmatter, body, appendix) => { @@ -9,19 +11,52 @@ 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 + ( + [ + #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 - ],) + ], + ) }, ) }, ) + +#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],) + }) + }, + ) +} diff --git a/themes/pyro/format.typ b/themes/pyro/format.typ index 4023403..9530931 100644 --- a/themes/pyro/format.typ +++ b/themes/pyro/format.typ @@ -14,16 +14,20 @@ 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") - #context.team-name - ], [ - #set text(30pt, fill: red) - Digital Engineering Notebook + grid( + rows: (1fr, 1fr), + [ + #set align(horizon) + #set text(50pt, font: "Tele-Marines", fill: gradient.linear(red, yellow)) + #context.team-name + ], + [ + #set text(30pt, fill: red) + Digital Engineering Notebook - #set text(20pt, fill: black) - #context.season - ]), + #set text(20pt, fill: black) + #context.season + ], + ), ) } From c74818e88b0ce81790139a5872c64026dbd7922c Mon Sep 17 00:00:00 2001 From: BattleCh1cken Date: Thu, 16 May 2024 15:42:41 -0400 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20all=20the=20remaining?= =?UTF-8?q?=20instances=20of=20context?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib.typ | 4 ++-- themes/pyro/entries.typ | 24 ++++++++++++------------ themes/pyro/format.typ | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib.typ b/lib.typ index bde73c3..8dd6d5e 100644 --- a/lib.typ +++ b/lib.typ @@ -34,7 +34,7 @@ show: doc => rules(doc) let cover-ctx = (team-name: team-name, season: season, year: year) - let cover-ctx = if cover == none { + let cover-content = if cover == none { let ctx = (team-name: team-name, season: season, year: year) print-cover(ctx: ctx, theme: theme) } else { @@ -44,6 +44,6 @@ page[] // Filler page - print-entries(theme: theme, cover-context: cover-context) + print-entries(theme: theme, cover-ctx: cover-ctx) body // FIXME: this should be ignored, but the document doesn't properly render without it. } diff --git a/themes/pyro/entries.typ b/themes/pyro/entries.typ index d54da62..5edf99c 100644 --- a/themes/pyro/entries.typ +++ b/themes/pyro/entries.typ @@ -2,7 +2,7 @@ #import "./colors.typ":* #import "./format.typ": * -#let frontmatter-entry(context: (:), body) = { +#let frontmatter-entry(ctx: (:), body) = { show: page.with( footer: align(center, counter(page).display()), background: place(rect(fill: gray, height: 100%, width: 15pt)), @@ -11,8 +11,8 @@ body } -#let body-entry(context: (:), body) = { - let entry-data = entry-types.at(context.type) +#let body-entry(ctx: (:), body) = { + let entry-data = entry-types.at(ctx.type) show: page.with( header: [ @@ -20,16 +20,16 @@ columns: (1fr, 2fr, 1fr), [ #set text(font: "Tele-Marines", weight: "bold") - #context.team-name - ], // TODO: get team name from from context + #ctx.team-name + ], // TODO: get team name from from ctx [ #set align(center) - #context.season + #ctx.season Engineering Notebook ], [ #set align(right) - #context.date.display("[month repr:long] [day padding:none], [year]") + #ctx.date.display("[month repr:long] [day padding:none], [year]") ], ) #line(length: 100%, stroke: 0.5pt) @@ -40,7 +40,7 @@ columns: (1fr, 0.3fr, 1fr), [ #set text(11pt) - _All information in this document is property of team #context.team-name, unless + _All information in this document is property of team #ctx.team-name, unless otherwise stated_ ], [ @@ -49,9 +49,9 @@ ], [ #set align(right) - *Signature:* #context.author + *Signature:* #ctx.author #linebreak() - *Witness:* #context.witness + *Witness:* #ctx.witness ], ) ], @@ -59,7 +59,7 @@ ) block[ - #title(entry-data.color)[#context.title] + #title(entry-data.color)[#ctx.title] #h(1fr) #title(entry-data.color)[#entry-data.title] ] @@ -71,7 +71,7 @@ body } -#let appendix-entry(context: (:), body) = { +#let appendix-entry(ctx: (:), body) = { show: page.with(header: [ = Appendix header ], footer: [Appendix footer]) body diff --git a/themes/pyro/format.typ b/themes/pyro/format.typ index 9530931..bc4a990 100644 --- a/themes/pyro/format.typ +++ b/themes/pyro/format.typ @@ -9,7 +9,7 @@ doc } -#let cover(context: (:)) = { +#let cover(ctx: (:)) = { grid( columns: (10em, 1fr), gutter: 20pt, @@ -19,14 +19,14 @@ [ #set align(horizon) #set text(50pt, font: "Tele-Marines", fill: gradient.linear(red, yellow)) - #context.team-name + #ctx.team-name ], [ #set text(30pt, fill: red) Digital Engineering Notebook #set text(20pt, fill: black) - #context.season + #ctx.season ], ), ) From 9cab7d285af0530e76a23f39d9fc6deaf92656d1 Mon Sep 17 00:00:00 2001 From: BattleCh1cken Date: Thu, 16 May 2024 21:42:28 -0400 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=8E=A8=20Move=20the=20components=20to?= =?UTF-8?q?=20their=20own=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/pyro/components/components.typ | 4 +++ .../decision-matrix.typ} | 31 +----------------- themes/pyro/components/glossary.typ | 0 themes/pyro/components/pro-con.typ | 0 themes/pyro/components/toc.typ | 32 +++++++++++++++++++ themes/pyro/entries.typ | 5 +-- themes/pyro/pyro.typ | 2 +- 7 files changed, 41 insertions(+), 33 deletions(-) create mode 100644 themes/pyro/components/components.typ rename themes/pyro/{components.typ => components/decision-matrix.typ} (61%) create mode 100644 themes/pyro/components/glossary.typ create mode 100644 themes/pyro/components/pro-con.typ create mode 100644 themes/pyro/components/toc.typ diff --git a/themes/pyro/components/components.typ b/themes/pyro/components/components.typ new file mode 100644 index 0000000..0eddc98 --- /dev/null +++ b/themes/pyro/components/components.typ @@ -0,0 +1,4 @@ +#import "./toc.typ": * +#import "./pro-con.typ": * +#import "./decision-matrix.typ": * +#import "./glossary.typ": * diff --git a/themes/pyro/components.typ b/themes/pyro/components/decision-matrix.typ similarity index 61% rename from themes/pyro/components.typ rename to themes/pyro/components/decision-matrix.typ index 2d2a575..80afc0b 100644 --- a/themes/pyro/components.typ +++ b/themes/pyro/components/decision-matrix.typ @@ -1,34 +1,5 @@ #import "/utils.typ" -#import "./format.typ": * -#import "./metadata.typ": * -#import "/packages.typ": tablex -#import tablex: * - -#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 - - ], - ) - }, - ) - }, -) +#import "../colors.typ": * #let decision-matrix(properties: none, ..choices) = { let data = utils.calc-decision-matrix(properties: properties, ..choices) diff --git a/themes/pyro/components/glossary.typ b/themes/pyro/components/glossary.typ new file mode 100644 index 0000000..e69de29 diff --git a/themes/pyro/components/pro-con.typ b/themes/pyro/components/pro-con.typ new file mode 100644 index 0000000..e69de29 diff --git a/themes/pyro/components/toc.typ b/themes/pyro/components/toc.typ new file mode 100644 index 0000000..2c4b3c7 --- /dev/null +++ b/themes/pyro/components/toc.typ @@ -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 + + ], + ) + }, + ) + }, +) diff --git a/themes/pyro/entries.typ b/themes/pyro/entries.typ index 5edf99c..94e4f7f 100644 --- a/themes/pyro/entries.typ +++ b/themes/pyro/entries.typ @@ -4,7 +4,7 @@ #let frontmatter-entry(ctx: (:), body) = { show: page.with( - footer: align(center, counter(page).display()), + footer: align(center, context counter(page).display()), background: place(rect(fill: gray, height: 100%, width: 15pt)), ) @@ -45,7 +45,7 @@ ], [ #set align(center) - #counter(page).display() + #context counter(page).display() ], [ #set align(right) @@ -71,6 +71,7 @@ body } +// TODO: make an actual appendix entry #let appendix-entry(ctx: (:), body) = { show: page.with(header: [ = Appendix header ], footer: [Appendix footer]) diff --git a/themes/pyro/pyro.typ b/themes/pyro/pyro.typ index 9c81e3e..8046470 100644 --- a/themes/pyro/pyro.typ +++ b/themes/pyro/pyro.typ @@ -1,6 +1,6 @@ #import "./format.typ": * #import "./entries.typ": * -#import "./components.typ" +#import "./components/components.typ" #let pyro-theme = ( // Global show rules