Skip to content

✨ Revision theme #47

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 10 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
17 changes: 17 additions & 0 deletions themes/revision/colors.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#let red = rgb("#F43545").lighten(50%)
#let orange = rgb("#FA8901").lighten(50%)
#let yellow = rgb("#FAD717").lighten(50%)
#let green = rgb("#00BA71").lighten(50%)
#let blue = rgb("#00C2DE").lighten(50%)
#let indigo = rgb("#00418D").lighten(50%)
#let violet = rgb("#5F2879").lighten(50%)

#let color-map = (
"identify" : red,
"brainstorm" : orange,
"select" : yellow,
"build" : green,
"program" : blue,
"test" : indigo,
"improve" : violet,
)
8 changes: 8 additions & 0 deletions themes/revision/components/components.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#import "./decision-matrix.typ": *
#import "./gantt-chart.typ": *
#import "./glossary.typ": *
#import "./header.typ": *
#import "./pro-con.typ": *
#import "./result-table.typ": *
#import "./toc.typ": *
#import "./tournament.typ": *
34 changes: 34 additions & 0 deletions themes/revision/components/decision-matrix.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#import "/utils.typ"
#import "/packages.typ": tablex
#import "../colors.typ": *
#import tablex: *

#let decision-matrix(properties: none, ..choices) = {
let data = utils.calc-decision-matrix(properties: properties, ..choices)
rect(inset: 0.5pt)[
#table(
stroke: (),
inset: 0.75em,
columns: properties.len() + 2,
rows: auto,
[],
..for property in properties {
(align(center)[#property.name],)
},
align(center)[Total],
..for choice in data {
if choice.values.total.highest {(
table.cell(fill: green)[#align(center)[#choice.name]],
..for value in choice.values {(
table.cell(fill: green)[#align(center)[#value.at(1).value]],
)}
,)} else {(
align(center)[#choice.name],
..for value in choice.values {(
align(center)[#value.at(1).value],
)}
,)}
},
)
]
}
93 changes: 93 additions & 0 deletions themes/revision/components/gantt-chart.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#import "/packages.typ": timeliney
#import "../colors.typ": *

#let gantt-chart(
start: datetime,
end: datetime,
date-interval: 1,
date-format: "[month]/[day]",
tasks: (),
goals: none,
) = {
timeliney.timeline(
spacing: 5pt,

show-grid: true,
grid-style: (stroke: (dash: none, thickness: .2pt, paint: black)),

tasks-vline: true,
line-style: (stroke: 0pt),

milestone-overhang: 3pt,
milestone-layout: "in-place",
box-milestones: true,
milestone-line-style: (stroke: (dash: none, thickness: 1pt, paint: black)),
{
import timeliney: *

let difference = end - start
let dates-array = ()
let months-array = ()
let month-len = 0
let last-month = start.month()
let next

for value in range(int((difference.days())/date-interval)+1) {
next = start + duration(days: (value*date-interval))
dates-array.push(group(((next).display(date-format),1)))
if next.month() == last-month {
month-len += 1
last-month = next.month()
} else {
months-array.push(group(((datetime(year: next.year(), month: last-month, day: 1)).display("[month repr:long]"),month-len)))
month-len = 1
last-month = next.month()
}
}
months-array.push(group(((datetime(year: next.year(), month: last-month, day: 1)).display("[month repr:long]"),month-len)))

headerline(..months-array)
headerline(..dates-array)

let goal-color

if goals != none {
for goal in goals {
if goal.len() == 2 {
goal-color = none
} else {
goal-color = goal.at(2)
}
milestone(
at: goal.at(1),
style: (stroke: 0pt),
[
#place(center, dy: -8pt)[#line(angle: 90deg, length: 6pt)]
#box(fill: goal-color, outset: 3pt, radius: 1.5pt)[#goal.at(0)]
],
)
}
}

let colors = (red, orange, yellow, green, blue, violet)
let index = 0
let size = difference.days()/date-interval
let pos = ()

taskgroup({
for item in tasks {
pos = (item.at(1).at(0)+0.054, item.at(1).at(1)-0.054)
if item.len() == 2 {
if index == colors.len()-1 {
index = 0
}
task(item.at(0), pos, style: (stroke: (paint: colors.at(index), thickness: 5pt, cap: "square")))
index += 1
} else {
task(item.at(0), pos, style: (stroke: (paint: item.at(2), thickness: 5pt, cap: "square")))
}
}
})
}
)
}
25 changes: 25 additions & 0 deletions themes/revision/components/glossary.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#import "/utils.typ"

#let glossary() = utils.print-glossary(glossary => {
stack(
spacing: 2em,
dir: ttb,
[#grid(
rows: 1em,
columns: (25%, 75%),

align(left)[TERM],
align(left)[DEFENITION],
)],
..for entry in glossary {
([
#grid(
columns: (25%, 75%),
rows: auto,
[=== #entry.word],
[#entry.definition]
)
],)
}
)
})
13 changes: 13 additions & 0 deletions themes/revision/components/header.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#let header-map = (
"identify" : "Identify Problem",
"brainstorm" : "Brainstorm Solutions",
"select" : "Select and Plan",
"build" : "Build Solution",
"test" : "Test Solution",
"program" : "Program Solution",
"improve" : "Improve Solution"
)

#let header(title) = {
rect(height: auto, width: auto)[=== #title]
}
21 changes: 21 additions & 0 deletions themes/revision/components/pro-con.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#import "../colors.typ": *

#let pro-con(pros: [], cons: []) = {
table(
columns: (50%, 50%),
inset: 0.75em,
fill: (col, row) =>
if row == 0 {
if col == 0 {
green
}
if col == 1 {
red
}
},
align(left)[Positives],
align(left)[Negatives],
pros,
cons
)
}
7 changes: 7 additions & 0 deletions themes/revision/components/result-table.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#let result-table(
trial-count: 1,
subject: (),
data: ()
) = {
table()
}
77 changes: 77 additions & 0 deletions themes/revision/components/toc.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#import "/utils.typ"
#import "/themes/revision/colors.typ": *
#import "header.typ": header-map

#let toc() = utils.print-toc((frontmatter, body, appendix) => {
let last-page = 0
let previous-color

stack(
spacing: none,
[#heading(level: 1)[ENTRIES]#v(1em)],
[#grid(
rows: 1em,
columns: (1fr, 10fr, 2fr),
align(center)[PAGE],
align(center)[SUBJECT],
align(center)[DATE]
)],
..for entry in body {
if entry.at("page-number") - last-page > 1 {
for i in range(entry.at("page-number") - last-page - 2) {
([#table(
stroke: (luma(120) + 0.5pt),
rows: (18pt),
columns: (1fr, 10fr, 2fr),
align(center)[#(last-page + i + 1)],
align(horizon)[#place(dx: 35pt)[#rect(height: 18.5pt, width: 1pt, fill: black, stroke: 0pt)]],
[]
)],)
}
let i = entry.at("page-number") - last-page -1
([#table(
stroke: (luma(120) + 0.5pt),
rows: (18pt),
columns: (1fr, 10fr, 2fr),
align(center)[#(last-page + i + 1)],
align(horizon)[#place(dx: 35pt, dy: -4.25pt)[#rect(height: 10pt, width: 1pt, fill: black, stroke: 0pt)#place(center)[#rotate(180deg)[#polygon.regular(size: 5pt, fill: black)]]]],
[]
)],)
}
([#table(
stroke: (luma(120) + 0.5pt),
rows: (18pt),
columns: (1fr, 10fr, 2fr),
align(center)[#entry.at("page-number")],
if entry.at("type") != none {
previous-color = color-map.at(entry.at("type"))
align(left)[#highlight(fill: previous-color, radius: 2pt, extent: 2pt)[
#header-map.at(entry.at("type"))] #h(2pt)$->$ #entry.at("title")]
} else {
align(left)[#entry.at("title")]
},
align(center)[#entry.at("date").display("[month]/[day]/[year]")]
)],)

last-page = entry.at("page-number")
},
[#v(2em) #heading(level: 1)[APPENDIX] #v(1em)],
[#grid(
rows: 1em,
columns: (1fr, 10fr, 2fr),
align(center)[PAGE],
align(center)[SUBJECT],
align(center)[DATE]
)],
..for entry in appendix {
([#table(
stroke: (luma(120) + 0.5pt),
rows: (18pt),
columns: (1fr, 10fr, 2fr),
align(center)[#numbering("I", entry.at("page-number"))],
align(left)[#entry.at("title")],
align(center)[#entry.at("date").display("[month]/[day]/[year]")]
)],)
}
)
})
Empty file.
Loading
Loading